1747999 Members
4579 Online
108756 Solutions
New Discussion

Startup script

 
SOLVED
Go to solution
Griselda Sanchez
Frequent Advisor

Startup script

Right now i have a script that run under root and starts when the server startup, but it's in cront for root.
Is there other place that i can put it? at this momment, i just kill it, but i don't need this script run anymore.
Thanks
1 REPLY 1
Mark Grant
Honored Contributor
Solution

Re: Startup script

Startup scripts generally go in /sbin/init.d, they have a "case" statement in them, usually with a "start" and "stop" option. Have a look at one of the existing ones in /sbin/init.d and you'll see what I mean. Then, make a symbolic link from your script to /sbin/rcX.d where X is the run level you want the script to run in (probably 3). If you look in /sbin/rc3.d you will see how it works. The S or K at the start of the name indicates Start and Kill respectively and the numbers indicate which order the scripts will be run in during that run level. S links will be run during startup and K scripts will be run at shutdown.

cron isn't really the place to put these scripts. To remove your script from cron go "crontab -e", as root, and delete the offending line (it's vi) and then save the result (it's still vi)
Never preceed any demonstration with anything more predictive than "watch this"