Saturday, October 14, 2006

Linux boot script

Some days back I had written a script to stop/start
application as linux boots.

Instead of adding the script manually , you could try this :

On Debian
update-rc.d
is the debian utility to install and remove
System-V style init script links.

#Create the script
Like this

# make it executable
chmod a+x

# copy the script to /etc/init.d and run the below command
update-rc.d script defaults

# To Erase:
update-rc.d -f script remove

http://wiki.linuxquestions.org/wiki/Update-rc.d

On Redhat
chkconfig
on RedHat Linux Systems:
Add this 2 lines at the beginning of script
# chkconfig: 345 85 15
# description: Description of program
This will add to runlevel 3,4 and 5 , Start order priority
will be set to 85 while Stop/Shutdown order will be set to 15

Set execute permission to script ===> chmod +x script name
Copy the script to /etc/rc.d/init.d/

When added to the boot process using the "chkconfig --add script-name"
command the start order/priority will be set to 80 while the stop/shutdown
order will be set to 15. The process will be added to runlevels 3, 4 and 5.
This is enabled by generating links from the location of the script
(/etc/rc.d/init.d/) to the directory for the appropriate run level:
/etc/rc.d/rc#.d/. The file name in the run level directory will reflect if it
is used for boot (starts with an "S") or shutdown (starts with a "K")




No comments: