Normally I would place entries like this in the rc.local file in /etc/rc.d/ directory. I have never tried placing a script in the /etc/rc.d/ directory, for all you know it may even work.
Anyone else tried it? IBM Certified Specialist - MQSeries
Well, you can always put the script in /etc/rc.d/init.d then make a symbolic link to that script in the default runlevel directory, with a Sxx to start it. What I do, is take an existing script in /etc/rc.d/init.d and hack it up to fit my needs. You can then make a symbolic link to that script in your /etc/rc.d/rc0.d and /etc/rc.d/rc6.d and prefix it with a Kxx so it gets shutdown properly. Bruce Garlock
bruceg@tiac.net
For simple stuff you'd place code directly in the /etc/rc.d/rc.local script.
If you want someting that starts/stops at runlevels you can quite easily make a sysv init script by looking at the existing ones in /etc/rc.d/init.d . You don't need to bother with that hassle of doing the symlinks due to the wonder of 'chkconfig'. For example from this snippet :
#!/bin/sh
#
# Startup script for Tomcat, the Apache Servlet Engine
#
# chkconfig: 345 80 20
Note the 'chkconfig' line. The values mean the service should be 'on' at levels 345 and have start / stop priorities of 80 and 20 (for the S & K prefixed symlnks) . All you do is create your script which must accept at least 'start' and 'stop' as arguments, put it in /etc/rc.d/init.d and then add to the sysv process with :
/sbin/chkconfig --add yourscriptname
That will create the symlinks based on the 'chkconfig' line in the script itself, as described above.
After that you can treat your script the same as any other sysv init script.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.