- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Startup Script
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
02-01-2002 10:26 AM
02-01-2002 10:26 AM
The way the program starts from command line is: uagent start
Again Thanks in advance :-)
DaveAA2
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2002 10:38 AM
02-01-2002 10:38 AM
Re: Startup Script
You can put the script "uagent" in /sbin/init.d. Net create a file in /sbin/rc2.d called Sxxxuagent. This should be linked to /sbin/init.d/uagent,
cd /sbin/rc2.d
ln -s /sbin/init.d/uagent Sxxxuagent
If the same script can be called with a stop command, add another entry to /sbin/rc1.d
cd /sbin/rc1.d
ln -s /sbin/init.d/uagent Kyyyuagent
The converntion is xxx+yyy=1000
If you use this, The application uagent will be started at run level 2 and will be shutdown at run level 1.
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2002 10:41 AM
02-01-2002 10:41 AM
Re: Startup Script
If you look in /sbin/init.d, there is a file called template. You can use this to build your script. I would suggest just looking at the other scripts as well to get a feel for how to do it. As far as the number, the S900 level is free for user apps, so pick a number in there to use (we have apache launching under the S940apache script in /sbin/rc2.d). As long as you don't modify other files, you shouldn't screw up anything. Worst case, the app doesn't launch, and you go back and try again. Good luck!
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2002 10:44 AM
02-01-2002 10:44 AM
Re: Startup Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2002 10:46 AM
02-01-2002 10:46 AM
SolutionThis is not difficult. Just because a script runs when you execute it via an interactive shell does not mean that it will execute correctly at startup. The main difference is that you need to make sure that your path is correctly set and exported. Do this somewhere explicitly in your script or use absolute pathnames. Any other environment variables that are normally set in your .profile need to also be explicitly set in your script as well.
By convention, any variables that your script needs are set in a file /etc/rc.config.d/myscript then /etc/rc.config.d/myscript is included in your actual script like this:
if [ -r /etc/rc.config.d/myscript ]
then
. /etc/rc.config.d/myscript
fi
You actual script should be installed in /sbin/init.d/myscript and then linked symbolically to the appropriate startup and shutdown directories. In your case, you decided to start in run level 2 so you need to stop in run level 1. You need to decide if your startup is dependent upon any other services and order your 'S' file so that it falls after any required scripts.
Let's say that you have determined myscript (uagent - in your case) needs to start after S950xxx has run. Let's then choose S952myscript as a file name and create the link.
ln -s /sbin/init.d/myscript /sbin/rc2.d/S952myscript
Now by cenvertion the 'S' Number + the 'K' number should add to 1000 and be zero-padded if necessary to 3 digits. This almost always insure the correct lexical order. Now let's create the kill script
ln -s /sbin/init.d/myscript /sbin/rc1.d/K048myscript
That's all there is to it, Clay
If you taken care of that, the rest is easy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2002 10:48 AM
02-01-2002 10:48 AM
Re: Startup Script
This might be userful,
http://docs.hp.com/hpux/onlinedocs/os/startup.pdf
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2002 10:50 AM
02-01-2002 10:50 AM
Re: Startup Script
If you haven't, read either version of the document below. I???ll summarize the key points here.
/usr/share/doc/start_up.txt
http://docs.hp.com/hpux/onlinedocs/os/startup.html
The file /sbin/init.d/template is a good starting place for making your own start/stop scripts.
The /sbin/init.d directory contains all scripts used to startup and shutdown various subsystems.
Each script under /sbin/init.d should perform BOTH the startup and shutdown functions. In order to control the functionality within the script, each must also support standard arguments and exit codes. Scripts must be written for the POSIX shell. A template script may be found in /sbin/init.d/template.
There is no reason why the startup and shutdown script cannot start/kill multiple, but related processes. Remember to choose the appropriate rc
Each script in /sbin/init.d performs BOTH the startup and shutdown functions, and each will have two links pointing towards the script from /sbin/rc*.d: one for the start action and one for the stop action.
Start scripts begin with "S"; Kill (stop) scripts begin with "K". The order of execution for kill scripts is the reverse of the startup ones.
if a start script is placed in directory '/sbin/rc{X}.d' then its corresponding kill script is put in directory '/sbin/rc{X-1}.d'
A general rule-of-thumb is that the sequence number of the start script plus the sequence number of the kill script should add to 1000.
Subsystems should be killed in the opposite order they were started. This implies that kill scripts will generally not have the same numbers as their start script counterparts. If two subsystems must be started in a given order due to dependencies (e.g., S200sys1 followed by S300uses_sys1), the counterparts to these scripts must be numbered so that the subsystems are stopped in the opposite order in which they were started (e.g., K700uses_sys1 followed by K800sys1). The '1000' rule leads to this behavior.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2002 01:55 PM
02-01-2002 01:55 PM
Re: Startup Script
I now have a much better understanding of the whole process and I even got my software to run @ startup.
My script is a little crude in fact I am embarrased to show it, but it works.
Again thanks for the swift response :-)
DaveAA2