1833687 Members
3894 Online
110062 Solutions
New Discussion

Regarding scripts

 
SOLVED
Go to solution
vind123
Regular Advisor

Regarding scripts

1.I am able to see some of the unix start scripts and config files are under /sbin/init.d directory and /etc/rc.config.d . I am able to partly understand when system startup these files will be started. Not sure on this.What are these folders for?

2. Also if i want to put a shell script to get started when system is started and stop the shell script when system is shutdown. How do i do it?
5 REPLIES 5
Jonathan Fife
Honored Contributor
Solution

Re: Regarding scripts

Basically, the files in /sbin/init.d are start/stop scripts that are linked from the /sbin/rc#.d directories.

In the /sbin/rc#.d directories, the files starting with S are started when init climbs to that runlevel, and the ones starting with K are stopped when init descends to that runlevel.

/etc/rc.config.d holds scripts that (properly written) scripts in /sbin/init.d check to make sure they should be starting the process in question.

Here's a document containing further information on startup scripts (courtesy of James R. Ferguson from another, similar thread):

http://docs.hp.com/en/934/startup.pdf
Decay is inherent in all compounded things. Strive on with diligence
Steven E. Protter
Exalted Contributor

Re: Regarding scripts

Shalom,

The purpose of the two directories is radically different.

/etc/rc.config.d is not really scripting though functions and subroutines can be set up. It is basically a repository for parameters. You set a variable in mailsvrs to 1 and sendmail will start, you don't it does not.

/sbin/init.d is where startup scripts reside. They start services and very often read the other directtory but this is not mandatory.

sendmail startup reads whether to start or not from the aforementioned configuration file.

Other scripts merely execute in /sbin/init.d

An important convention for this directory is the script has a start and stop function and accepts a single parameter on startup.

Scripts here get that either from command input or from soft links in the various /sbin/rc#.d directories.

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
James R. Ferguson
Acclaimed Contributor

Re: Regarding scripts

Hi:

For an in-depth, but quick, understanding of the HP-UX startup/shutdown model, read the whitepaper that Johnathan listed, above.

The material is applicable to all HP-UX releases from 10.x thru 11i.

An additional resource is the manpages for 'rc(1M)':

http://www.docs.hp.com/en/B2355-60127/rc.1M.html

Regards!

...JRF...
rariasn
Honored Contributor

Re: Regarding scripts

Hi vind123,

# man rc
# man rc.config
# man init

rgs,


ran
vind123
Regular Advisor

Re: Regarding scripts

Thanks a lot for the info