LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Running script as daemon (https://www.linuxquestions.org/questions/linux-newbie-8/running-script-as-daemon-86741/)

StinkyFinger 08-28-2003 05:20 PM

Running script as daemon
 
Forgive my ignorance. I'm relatively new with Linux and had what most consider a simple question.

I'm running a web server which I start using a script I wrote...something like ./startserver.sh start. I want to run this script as a daemon so it starts up automatically w/o me logging in. i want this so if my computer goes down for whatever reason when it powers up it starts this script automatically.

i know i need to put it in /etc/rc.d/init.d but what then and how do i pass it the start command?:confused:

thanks in advance.

Skyline 08-28-2003 06:11 PM

This is a guess but ordinarily you'd create a symlink from the service in

/etc/rc.d/init.d

and put it in

/etc/rc.d/rcx.d

-were x is the run level you'd want the service to run at - once its in

/etc/rc.d/rcx.d

then rename it with Syy at the start of the name were capital S is the start signal and yy is the order number with which you want the service to start - ie some services are dependant on others already running etc etc - I must stress, this is only a guess.

Looking_Lost 08-28-2003 07:31 PM

The startup script from fading memory that you put in /etc/rc.d/init.d should take a particular format , take a look at ones that are already there and modify to suit.

Instead of manually creating sym links in each rc.x directory if your script called say, my_server has something like that at the start

#chkconfig: 35 59 34
#description: description of what this is
#processname: my_server

(where 35 are the run levels you want to start, 59 goes the priority to startup and 34 for when shutting down)

You can do chkconfig --add my_server and all the sym links in the right places will be automatically created for you, hopefully :)


All times are GMT -5. The time now is 08:05 AM.