Run Execute Shell Script While System Booting Startup


1)After write the shell script we have to place that shell script under /etc/init.d/.
2)Then add the following line to that shell script at the begining
# chkconfig: 2345 95 20
# description: Some description
3)add into chkconfig
#chkconfig --add
NOTE: if we did STEP:2) then only we can add using chkconfig
4)chkconfig on

CONFIRMATION: To check if we go to /etc/rc.d/
we have 6 run runlevel script directory
rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d
if go to that direcotry we can see the shell scrip name with "S" & "K"
S indicate start the script when it boots up,
K metion down cleanly when it is going shut down
Soft Link syntax
For Manual Adding.
ln -s /etc/init.d/script-daemon-name /etc/rc.d/rc5.d/S50cript-daemon-name
ln -s /etc/init.d/script-daemon-name /etc/rc.d/rc5.d/K50script-daemon-name

How To Run Command while system Booting.
We can run the command using /etc/rc.d/rc.local
/etc/rc.d/rc.local - here what are command we put it will run while booting.
Using these method we can run the command shell script as daemon while booting or start up of the system.

No comments:
Write comments