Not sure for CentOS. But to get update-rc.d correctly working on Ubuntu your script needs to have a header like this:
#! /bin/sh ### BEGIN INIT INFO # Provides: What is the Script doing # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Short Description # Description: Longer Description ### END INIT INFO # Author: Name <[email protected]> Regards Janosch Am 09.08.2010 11:45, schrieb roy mukasa: > I am trying to get it to run on cent os. > I also added these commands > > ln -s /etc/init.d/<script name.sh> /etc/rc.d/rc5.d/S50<script name.sh> > ln -s /etc/init.d/<script name.sh> /etc/rc.d/rc5.d/K50<script name.sh> > > > > On 9 August 2010 11:37, Simon Vass <[email protected]> wrote: >> If your running Ubuntu, you also need to also run something like >> >> update-rc.d <nameofscript> defaults >> >> which adds the /etc/init.d/script symlinks to the various /etc/rc#.d >> folders. It is these folders that determine when a script runs depending on >> the run-level. You could also add them manually using ln. >> >> Simon Vass >> Technical Manager >> E-Tech Uganda Ltd >> http://www.etech.ug >> Tel: +256 (0) 312260620 or (0) 312260621 >> Email: [email protected] >> >> >> >> ----- Original Message ----- >> From: "roy mukasa" <[email protected]> >> To: "Linux Users Group Uganda" <[email protected]> >> Sent: Monday, August 9, 2010 11:26:16 AM GMT +03:00 Iraq >> Subject: [LUG] Automating a script in linux >> >> Hey guys have a quick one, ok after i have written a script in linux >> and i would want it to start automatically when a computer is >> restarted, what can i do? i Have managed to add the script to >> /etc/init.d/ then i have also run the command chmod +x <script name> >> to make it executable. So what else can i do to make the script run >> automatically when the computer is restarted? >> >> Regards >> -- >> Roy Mukasa >> MUK FCIT >> +256774291110 >> _______________________________________________ >> LUG mailing list >> [email protected] >> http://kym.net/mailman/listinfo/lug >> >> LUG is generously hosted by INFOCOM http://www.infocom.co.ug/ >> >> All Archives can be found at http://www.mail-archive.com/[email protected]/ >> >> The above comments and data are owned by whoever posted them (including >> attachments if any). The List's Host is not responsible for them in any way. >> --------------------------------------- >> >> _______________________________________________ >> LUG mailing list >> [email protected] >> http://kym.net/mailman/listinfo/lug >> >> LUG is generously hosted by INFOCOM http://www.infocom.co.ug/ >> >> All Archives can be found at http://www.mail-archive.com/[email protected]/ >> >> The above comments and data are owned by whoever posted them (including >> attachments if any). The List's Host is not responsible for them in any way. >> --------------------------------------- >> >> > > > -- Janosch Maier <[email protected]> -- http://phynformatik.de This E-Mais is signed via GnuPG <http://gnupg.org/>. My public key: 0xEB21B1DE
signature.asc
Description: OpenPGP digital signature
_______________________________________________ LUG mailing list [email protected] http://kym.net/mailman/listinfo/lug LUG is generously hosted by INFOCOM http://www.infocom.co.ug/ All Archives can be found at http://www.mail-archive.com/[email protected]/ The above comments and data are owned by whoever posted them (including attachments if any). The List's Host is not responsible for them in any way. ---------------------------------------
