Operating System - HP-UX
1848206 Members
7389 Online
104022 Solutions
New Discussion

Ideas to put a script as Startup.

 
SOLVED
Go to solution
joe_91
Super Advisor

Ideas to put a script as Startup.

Team:

I need to put a script which is in /opt/socket.sh (a socket program) in the startup so that it would run all the time. My questions would be..
1. What number i should assign th SXXX for the socket.sh.
2. how do i make sure that it runs all the time after it started.
Please help. Env. 11.0
Thanks
Joe.
3 REPLIES 3
joe_91
Super Advisor

Re: Ideas to put a script as Startup.

Team:

Also should i have an associated K script? if so what would it do.

Thanks
Joe.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Ideas to put a script as Startup.

The answer is of course that it depends. A fairly safe sequence would be after NFS starts since you are assured that the network is active at that point. I suggest that the startup be in run level 3 which implies that the shutdown be in run level 2.

I would do something like create a script called /sbin/init.d/socketsh
and symbolically link it to /sbin/rc3.d/S101socketsh and /sbin/rc2.d/K899socketsh.

Perhaps the easiest method to make certain that your program is running is to creatr a cronjob that runs every few minutes that does a ps -e to test for the existence of your daemon and restart it if necessary. You should probably add some code to this script to test whether you are at run-level 3 before looking for the process.
If it ain't broke, I can fix that.
steven Burgess_2
Honored Contributor

Re: Ideas to put a script as Startup.

Hi Joe

There is a pretty good document in

/usr/share/doc/filesys.txt

Tha will explain your stop and start scripts config , with reference to run levels and sequencer directories etc

As far as you S and K - they generally add up to a thousand. Depending on when you want the service to start you stick the link to the /sbin/init.d/script where you require

HTH

Steve
take your time and think things through