Operating System - HP-UX
1827293 Members
3149 Online
109717 Solutions
New Discussion

Re: what file do you modify to stop a process at shutdown/reboot

 
SOLVED
Go to solution
David Heard
Occasional Advisor

what file do you modify to stop a process at shutdown/reboot

what file do you modify to stop a process at shutdown/reboot
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: what file do you modify to stop a process at shutdown/reboot

Generally, you make an entry in /sbin/init.d with a symbolic link to a 'K' script in /sbin/rc1.d or /sbin/rc2.d. Man rc for details. Typically a process is started with an 'S' script and stopped with a 'K' script which are actually linked to the same script. The 'K' scripts see a 'stop' argument and the 'S' scripts receive a 'start' argument.



If it ain't broke, I can fix that.
Pete Randall
Outstanding Contributor

Re: what file do you modify to stop a process at shutdown/reboot

David,

Usually a startup/shutdown script is place in /sbin/init.d/{processname} and links are made from the appropriate run level directories. For example:

# ll /sbin/*/*webd
-r-sr-xr-x 1 root sys 2929 Feb 23 2001 /sbin/init.d/webd
lrwxrwxrwx 1 root sys 17 Jun 14 2000 /sbin/rc2.d/K001webd -
> /sbin/init.d/webd
lrwxrwxrwx 1 root sys 17 Jun 19 2000 /sbin/rc3.d/S999webd -
> /sbin/init.d/webd

The K001webd link is for shutdown, the S999 webd link is the startup.


Pete

Pete
Steven E. Protter
Exalted Contributor

Re: what file do you modify to stop a process at shutdown/reboot

actual scripts reside here

/sbin/init.d

links in /sbin/rc#.d

replace # with run level link to scrpts in /sbin/init.d

To have a startups script at run level 3 create a soft link pointing to the /sbin/init.d script starting with a captial S

For shutdown start the softlink with a capital K

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Stuart Abramson_2
Honored Contributor

Re: what file do you modify to stop a process at shutdown/reboot

I also put an on/off flag in /etc/rc.config.d/"subsystem", where "subsytem" is the name of the process you wish to run.

For an example, look at:
../etc/rc.config.d/cron
../sbin/init.d/cron
../sbin/rc2.d/S730cron
../sbin/rc1.d/K270cron

(Except that I put my scripts i:
..rc4.d ..(start)
..rc3.d ..(kill)
I also change my /etc/inittab first line to say "4" instead of "3":

..# head /etc/inittab
..init:4:initdefault:

Here's another good trick. The total of your SXXX and KXXX should be 1000, as above. That ensures that the processes start and stop in the same relative order.