LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to custom create a service (https://www.linuxquestions.org/questions/linux-general-1/how-to-custom-create-a-service-412780/)

Scrag 02-07-2006 06:45 PM

How to custom create a service
 
Hi.

I have a script file that I need to run as a service or sorts. Right now I can run it then just kill the pid when I want to shut it off. Id prefer a way to make it a service so I can type, for example:

service myservice stop

-to stop the service, and

service myservice start

- to start it.

Can anyone tell me how to do this? Or if theres a better way, please let me know.

Thanks again! :jawa:

320mb 02-07-2006 07:35 PM

this is what bash scripting is for.........you make 2 scripts, one turns the service on, the other to turn it off, and execute like so.......
Code:

./service_on
./service_off

OR you can put the scripts in your home DIR. and put a link to them to the desktop and then all you have to do is click on the link to turn the service on/off.......easy

Matir 02-07-2006 07:50 PM

If you want the standard redhat-like service command, look in /etc/init.d (most likely) at some of the scripts there and copy one for your own use and your command.


All times are GMT -5. The time now is 01:57 AM.