Contributors

Friday, July 29, 2011

Adding a startup script/service in Linux!

Startup root directory: /etc/init.d
Directory '/etc/rcX.d' holds list of services to be brought up during startup of runlevel 'X' and to be brought down during termination of runlevel 'X'.
Command: 'update-rc.d' is to modify this list or add our own custom executable shell script to be run during startup. Let us see how!
update-rc.d defaults: Registers our startup script.

update-rc.d -f apache remove: This forces the apache service to be removed from being invoked during startup.
update-rc.d apache defaults: This makes apache service to start with default priority.
update-rc.d apache defaults 90: This makes apache service to start at custom priority '90'.
update-rc.d apache 20 60: This starts apache at '20' priority and ends with '60' priority.
update-rc.d apache start 30 2 3 stop 40 4 5: This specifies different priority for different runlevels. Starts at '30' for runlevels 2 and 3, and stops at '40' for runlevels 4 & 5.
Thanks.

No comments:

Post a Comment