Re: running a shell script in the init file
Bryan Murdock <[email protected]>
| Newsgroups | gmane.org.user-groups.linux.pdxlug |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 08 Dec 2004 15:01:13 -0800, Kevin Williams <[email protected]> wrote: > All, > > I'm working on a project where I have to start up some commands that run > for the life of the computer's up time. I would like these to start > when the computer boots up, and stop after the computer shuts down > (running Redhat). > > What I have to run are pretty simple commands: > 1. multiple perl calls > 2. multiple command tail -f log_file_name | logger local3.info > > What I figured I would do would be to create a startup script for the > perl commands and another for the tail commands (shell script that > executes them all). > > >From my understanding, I will have to have a start, stop, and restart > method (which calls stop and start). The start method I can handle > (simply call the command and append the &), but how do I go about > stopping the bash scripts? > > Thanks in advance, It sounds like you want these to be run like any other service such as sendmail or httpd. For Redhat you can see examples of how the scripts for starting and stopping daemons are done in /etc/init.d/. Just create your own and put it in /etc/init.d with the rest. Then you need the appropriate symbolic links for the runlevels you want in /etc/rc.d/rc<runlevel>.d/ pointing back to the start/stop script in /etc/init.d. Ask if you need more details or help. Bryan