On Thu, 21 Feb 2002, Eduardo M. A. M. Mendes wrote: > Hello > > I have a script that needs to be started everytime I boot my linux boot. I > normally start the daemon but issuing the command > /usr/local/sharity/sbin/sharity.init start. How can I include this command > (script) together with the other commands that start at boot time. I would > like to see somehing like: > > Starting sharity ......... [OK]
Take a look at the scripts in /etc/rc.d/init.d. You can copy one of the scripts there and modify it to your needs. The interesting lines are: # chkconfig 345 85 15 This line tells what run-levels the script is enabled in (3, 4 and 5), and at what point in the boot process it's started and stopped. These are important if your script relies on, say, networking to be started earlier in the process. Next, edit the relevant portions of the start) and stop) sections of the file. Don't forget to add a couple lines to the help section. When that's done, issue the following command: service name_of_your_script start To make sure it starts on bootup: chkconfig --level 345 name_of_your_script on Why not just tack it to rc.local? The above method means that your service is correctly stopped and started in the appropriate run-levels, rather than always running at boot. It also makes it easier to administer with the chkconfig and service utilities.
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
