Re: making a script into a service

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, Dec 9, 2013 at 8:40 AM, Liam O'Toole <liam.p.otoole@xxxxxxxxx> wrote:
> On 2013-12-09, Larry Martell <larry.martell@xxxxxxxxx> wrote:
>> On Mon, Dec 9, 2013 at 8:00 AM, Fabrizio Di Carlo
>><dicarlo.fabrizio@xxxxxxxxx> wrote:
>>> Try to use this
>>> http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ it
>>> allows you start/stop/restart the script using the following commands.
>>>
>>> python myscript.py start
>>> python myscript.py stop
>>> python myscript.py restart
>>>
>>>
>>> Source:
>>> http://stackoverflow.com/questions/16420092/how-to-make-python-script-run-as-service
>>
>>
>> Yes, I've seen that question and site. I want to be able to control it
>> with the service command. The technique on this site makes the script
>> a daemon, but that does not make it controllable with service.
>>
>>
>
> Assuming the first line of your script is
>
>         #!/usr/bin/env python
>
> and the script is executable, then you can invoke it like this:
>
>         myscript start
>         myscript stop
>         myscript restart
>
> If you then place the script in /etc/init.d/, you have yourself a
> service. See the 'service' man page.

Thanks!
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux