- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to auto start a script which required csh envi...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2001 07:41 AM
01-03-2001 07:41 AM
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2001 07:47 AM
01-03-2001 07:47 AM
Re: How to auto start a script which required csh enviroment
#!/usr/bin/csh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2001 08:10 AM
01-03-2001 08:10 AM
Re: How to auto start a script which required csh enviroment
Scripts in /sbin/init.d (or /sbin/rc?.d) will execute independently of their respective shells.
Simply make sure that the first line of your script reads:
#!/usr/bin/csh
if you want a csh to interpret the script.
Best regards,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2001 08:57 AM
01-03-2001 08:57 AM
Re: How to auto start a script which required csh enviroment
What You wrote it is correct if Your script's first line is good. But You can run it only when mounted /usr filesystem where You find csh. Don't forget it !
regards, Saa.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2001 09:19 AM
01-03-2001 09:19 AM
Re: How to auto start a script which required csh enviroment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2001 09:23 AM
01-03-2001 09:23 AM
Re: How to auto start a script which required csh enviroment
Thank you for you suggestion.Do you mean in my start script,let's say /sbin/init.d/my_startscript,I put the first line to
#!/usr/bin/csh.?
I think it should be good solution.But I still want to confirm it.so let me explain the complete case.
The user is called "user1",his default login shell is "/usr/bin/sh".He configured some customrized parameter in /home/user1/.cshrc. Every time when he try to run his bourne shell script "user1_script",he do "csh;user_script".I think the reason that he run "csh" command is that he want to execute /home/user1/.cshrc.I read the user_script,I did not see any relation between user_script and .cshrc.I don't know why user must run csh first,then start his user_script.Anyway,I just want my auto_start script match his procedure.
So do you think that I put the #!/usr/bin/csh in the first line of my start script,which can execute .cshrc and match this user's procedure?
thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2001 09:46 AM
01-03-2001 09:46 AM
Re: How to auto start a script which required csh enviroment
Yes, the #!/usr/bin/csh line will cause the rest of the script to be executed by the c shell.
Make sure the #! are the absolute first two characters of the file - no indentation or blank lines above. Otherwise, the line will just be a comment and the script will most likely run under the POSIX shell.
--Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2001 10:35 PM
01-03-2001 10:35 PM
SolutionThat's it! If your script starts with the following line (without any indentation or space before):
#!/usr/bin/csh
and that, at that time, /usr is mounted, C-shell will be used to interpret the script.
Nevertheless, the file /home/user1/.cshrc won't be run because there is no relation with scripts in /sbin/rc?.d or /sbin/init.d and a user directory.
You can explicitely force that file to be read by putting this line in the script (i.e. as second line):
source /home/user1/.cshrc
Make sure that the /home/user1/.cshrc doesn't use any terminal related command (like echo, tset...) as there won't be any terminal attached to the process at run time.
Best regards,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2001 10:39 PM
01-03-2001 10:39 PM
Re: How to auto start a script which required csh enviroment
Another point to keep in mind:
Scripts in /sbin/init.d run as 'root', so make sure this is what you want to do.
Otherwise, your script should contain a line like 'su user1 -c
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2001 07:51 AM
01-04-2001 07:51 AM
Re: How to auto start a script which required csh enviroment
I got it.Thank you for your excellent guide.
regards
ervin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2001 07:54 AM
01-04-2001 07:54 AM
Re: How to auto start a script which required csh enviroment
Thanks for the points.
Dan