LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to register a Tcl script as a service? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-register-a-tcl-script-as-a-service-188416/)

vlbaranov 06-01-2004 09:11 AM

How to register a Tcl script as a service?
 
Hi all,
I have a Tcl script that runs all the time (takes actions based on the logic).
Right now I manually run the script from a shell every time the box is rebooted. I am wondering if there is a functionality to register the script as a "service" ( daemon could be the correct term, my apologies) ?
Thank you all in advance.

iluvatar 06-01-2004 09:31 AM

you could include the script in the boot sequence, wich will start it automaticly on boot :) depends on the init style how this is done... for slackware style boot (don't know official name): edit the /etc/rc.d/rc.local file and put the command to start the script at the end, for SysV init style, it's a bit more tricky. You'll have to put a script wich starts the Tcl script in the /etc/init.d dir, and create a symlink with S<nr><scriptname> to the script in the /etc/init.d/rc<runlevel>.d/ directory to the script... the script wich starts the Tcl script must accept an option "start" to start the 'service', your Tcl script (see other scripts in the /etc/init.d/ directory for examples) and it may accept an option "stop" to stop the Tcl script (on shutdown for example). To make it stop you must make a symlink like K<nr><scriptname> in the /etc/init.d/rc<runlevel>.d/ directory. <nr> means a number from 00 to 99 wich tells the init in wich order the scripts are executed.

Greetz,
.-=~ iluvatar ~=-.

vlbaranov 06-01-2004 10:14 AM

iluvatar,
I have Red Hat release 7.1 with OS release 2.4.2-2
Where do I edit the boot sequence:confused:


All times are GMT -5. The time now is 06:53 PM.