SUMMARY: how to setup for a software to run at time of reboot/poweron

From: Julie Xu (
Date: Mon Dec 18 2000 - 21:07:36 CST

Dear all,

Great thanks for all the help. I find this list give the most
quick and helpful answer. Again, great thanks for you all.

Some passages I have taken from these e-mails for the summary are:
First, you put the startup script, usually dhcpd, in /etc/init.d directory.

Then create a link to /etc/rc2.d :

        cd /etc/rc2.d
        ln -s ../init.d/dhcpd S99dhcpd

See the README file in either /etc/rc2.d or /etc/init.d ... it's
a pretty strange system, but it's great once you get use to it.
Basically the startup scripts are in /etc/init.d, they are linked
to /etc/rc[0-3].d, and the links start with S if they start the
package, or K if they kill it. The sequence number (eg. S99)
specifies the order they are started or killed. Use a high one
to ensure earlier required things are already started.
the script in /etc/inet.d should something like:
case "$1" in
        [ -f $DHCPD ] && {
                $DHCPD $IF &

        if [ "X$DhcpdPid" != "X" ]
                /bin/kill $DhcpdPid

        if [ "X$DhcpdPid" != "X" ]
                /bin/kill $DhcpdPid
                [ -f $DHCPD ] && {
Solaris normal init state ( working mode ) is 3 .
that means that all rc scripts in /etc/rc2.d and /etc/rc3.d are run on boot
and after reboot
Solaris shutdown states are 0 or 6 ( 0 - being shutdwon and 6 being reboot )

runscripts are actually links to scripts located in /etc/init.d
those scripts take an arg called "start" or "stop"
in order to start a script you need to create a link from the run script in
/etc/init.d to /etc/rc2.d or /etc/rc3.d with a SXXscriptname
the S tells init to send a start arg to the script and the XX are numbers
that tells init what to run first ( so for example if you want to run a dhcp
server it should have a greater number than the intesvc so that network
services will start first )
                You must have a script to start DHCP server in
/etc/init.d something like "dhcp" that works as follow "dhcp start" to
start de daemmon and "dhcp stop" to stop the service.

You should make a script to do that an put it in directory "rc3.d" in
order to start it in run level 3.
The installation should have linked /etc/init.d/dhcp into several of the
/etc/rc*.d directories.

Here are the list of (hard) links installed on my dhcp server.

alright. it's done but still will not start at boot
time. determine what "runlevel" you want dhcpd to run
in and what "runlevel" you want it to be killed or not
run in. for example:

runlevel 3 start
runlevel 2 stop
runlevel 1 stop
runlevel 0 stop
runlevel S stop

to implement the above scenario, create symbolic links
as follows:
ln -s /etc/init.d/dhcpd /etc/rc3.d/S99dhcpd
ln -s /etc/init.d/dhcpd /etc/rc2.d/K99dhcpd
ln -s /etc/init.d/dhcpd /etc/rc1.d/K99dhcpd
ln -s /etc/init.d/dhcpd /etc/rc0.d/K99dhcpd
ln -s /etc/init.d/dhcpd /etc/rcS.d/K99dhcpd

for example, if you change runlevels from startup to 3
(probably your default), it will run all the S*
scripts in rc.1 rc.2 rc.3 etc. with the "start"
argement and the K* scripts with the "stop argument".
this architecture means you can simply create and
maintain one original script in /etc/init.d and create
symbolic links.

Marry Christmas and Happy new year

Julie Xu

Unix/Network administrator
Information Technology and Communication
University of Western Sydney, Macarthur
Campbelltown NSW 2560

Phone: 61 02 46203098

sunmanagers mailing list

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:24 CDT