How to get this init.d script to start at server restart? How to get this init.d script to start at server restart? shell shell

How to get this init.d script to start at server restart?


Make sure your script is added for service management by chkconfig. Use chkconfig --list to see the list and use chkconfig --add scriptname if it's not there. After that configure the runlevels you want it to be called into. I would guess it's 3, 4 and 5 so: chkconfig --level 345 scriptname on.


You should tell us how exactly you are running the script from init.d

But here is a dirty workaround:

Change the line

start)

to

start|'')

This will make it start if there are no parameters passed.


If you want to start a service through command line you can just add in /etc/rc.d/rc.local too for the same instead of creating a service file in init.d.