- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- rc scripts
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
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
09-26-2006 04:15 PM
09-26-2006 04:15 PM
How do i define environment (env) with in the script ,which is a startup script.
For some reason ftp logins are all not working which is defined within the script.
.netrc files have been updated appropriately.
I did get good responses when i posted the related topic though.Appreciate any suggestions.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2006 05:58 PM
09-26-2006 05:58 PM
Re: rc scripts
/sbin/init.d/
Then
You can use su - accountname -c script
and ensure this account has the appropriate env via its .profile and .kshrc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2006 02:33 AM
09-27-2006 02:33 AM
SolutionOtherwise all environment paths and variables need to be definded in the startup script, via su to another user ( not for FTPD as it runs as root typically ).
More info on how things are setup on your side will help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2006 02:41 AM
09-27-2006 02:41 AM
Re: rc scripts
Standard startup scripts run by '/sbin/rc' are going to be devoid of any environmental variables that your application needs.
It's up to you to either declare variables you need in your customized startup script, or to source (read) a file containing them as your startup script begins executing.
One cruder method to employ is to do an 'su -
Regards!
...JRF...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2006 03:55 AM
09-27-2006 03:55 AM
Re: rc scripts
To add to James' valid points -
If the startup you wish to add is using ftp, insure it starts behind any ftp rc startup scripts, else the service may not be available whe you want to start yours. [My apologies if this was overly obvious.]
I'm attaching a doc we have found useful in the past when writing new rc level startup scripts.
Note that it provides information on testing your script real time without having to perform a reboot, etc.
Best of luck on this.
Regards,
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2006 03:57 AM
09-27-2006 03:57 AM
Re: rc scripts
Note that is says for version 10.X, but we used it for 11.0, etc.
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2006 04:26 AM
09-27-2006 04:26 AM
Re: rc scripts
The document attached by Dave is a favorite of mine, since it quite clearly describes the entire paradigm.
Despite the fact that the document was written for the 9x-10.0 transition of HP-UX, it continue to apply through all current releases (11.23). About the only update is that a script exiting with a return value of '4' denotes one that started a background process. The manpages for 'rc(1M') document this and provide an alternative, but parallel, document.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2006 09:46 AM
09-27-2006 09:46 AM
Re: rc scripts
What could be the right way or format to specify the .profile within the script.
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2006 10:49 AM
09-27-2006 10:49 AM
Re: rc scripts
> What could be the right way or format to specify the .profile within the script?
As I noted before, you would do something like:
# su - subhashni -c /home/subhasni/his_thing
Assuming that the calling script was running as root, as a normal 'startup' script would be, this changes the user to 'subhasni', *runs* 'subhasni's '.profile' as a consequence of the 'su -' and then executes "/home/subhasni/his_thing".
The principal problem with this approach is that the login '.profile' is generally constructed to be interactive. Commands therein like 'stty' and 'tset' are meant to be executed when associated with a *terminal*. Unless you conditionally exclude these commands with:
# if [ -t 0 ]; then
> stty ...
> fi
...then when your profile runs, you will see messages like "Not a typewritter".
The alternative is *not* to allow the user's profile to be sourced *and* to include any or all environmental variables by sourcing (reading) a file containing them as part of your executed script. Thus, you could do:
# su subhashni -c /home/subhasni/his_thing
...Notice the absence of the "-" after the 'su' in this form. This means that "subhasni"'s profile is *not* read (sourced). The assumption is probably that within the script '/home/subhasni/his_thing' is something like:
# . /home/subhasni/env_vars
Note that this is a dot character, followed by as space, followed by a script name. This is "sourcing" or reading. The 'env_vars' file might look like:
PATH=${PATH}:/home/subhasni
HOME=/home/subhasni
DOING=mything
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2006 04:31 PM
09-27-2006 04:31 PM