We have a python script that is currently run from cron. We want to make it into a service so it can be controlled with service start/stop/restart. Can anyone point me at site that has instructions on how to do this? I've googled but haven't found anything.
The keyword your looking for here is "daemonize".
On 9 December 2013 12:54, Larry Martell larry.martell@gmail.com wrote:
We have a python script that is currently run from cron. We want to make it into a service so it can be controlled with service start/stop/restart. Can anyone point me at site that has instructions on how to do this? I've googled but haven't found anything. _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Mon, Dec 9, 2013 at 8:00 AM, Andrew Holway andrew.holway@gmail.com wrote:
The keyword your looking for here is "daemonize".
I don't just want to make it into a daemon - I want to control it with the service command.
On 9 December 2013 12:54, Larry Martell larry.martell@gmail.com wrote:
We have a python script that is currently run from cron. We want to make it into a service so it can be controlled with service start/stop/restart. Can anyone point me at site that has instructions on how to do this? I've googled but haven't found anything. _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
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...
On Mon, Dec 9, 2013 at 1:54 PM, Larry Martell larry.martell@gmail.comwrote:
We have a python script that is currently run from cron. We want to make it into a service so it can be controlled with service start/stop/restart. Can anyone point me at site that has instructions on how to do this? I've googled but haven't found anything. _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Mon, Dec 9, 2013 at 8:00 AM, Fabrizio Di Carlo dicarlo.fabrizio@gmail.com 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...
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.
On Mon, Dec 9, 2013 at 1:54 PM, Larry Martell larry.martell@gmail.comwrote:
We have a python script that is currently run from cron. We want to make it into a service so it can be controlled with service start/stop/restart. Can anyone point me at site that has instructions on how to do this? I've googled but haven't found anything. _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
-- "The intuitive mind is a sacred gift and the rational mind is a faithful servant. We have created a society that honors the servant and has forgotten the gift." (A. Einstein)
"La mente intuitiva è un dono sacro e la mente razionale è un fedele servo. Noi abbiamo creato una società che onora il servo e ha dimenticato il dono." (A. Einstein)
Fabrizio Di Carlo _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/cento
Turn it into a daemon as described, then take a look at the existing scripts in /etc/init.d/. There might even be a template in there iirc. Your script will likely be a simple wrapper around your daemonized python program.
After that, just do a "chkconfig --add <myscript>“ where myscript is the name of your script in /etc/init.d. On Dec 9, 2013 7:05 AM, "Larry Martell" larry.martell@gmail.com wrote:
On Mon, Dec 9, 2013 at 8:00 AM, Fabrizio Di Carlo dicarlo.fabrizio@gmail.com wrote:
Try to use this
http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/i...
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...
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.
On Mon, Dec 9, 2013 at 1:54 PM, Larry Martell <larry.martell@gmail.com wrote:
We have a python script that is currently run from cron. We want to make it into a service so it can be controlled with service start/stop/restart. Can anyone point me at site that has instructions on how to do this? I've googled but haven't found anything. _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
-- "The intuitive mind is a sacred gift and the rational mind is a faithful servant. We have created a society that honors the servant and has forgotten the gift." (A. Einstein)
"La mente intuitiva è un dono sacro e la mente razionale è un fedele
servo.
Noi abbiamo creato una società che onora il servo e ha dimenticato il dono." (A. Einstein)
Fabrizio Di Carlo _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/cento
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On 2013-12-09, Larry Martell larry.martell@gmail.com wrote:
On Mon, Dec 9, 2013 at 8:00 AM, Fabrizio Di Carlo dicarlo.fabrizio@gmail.com 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...
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.
On Mon, Dec 9, 2013 at 8:40 AM, Liam O'Toole liam.p.otoole@gmail.com wrote:
On 2013-12-09, Larry Martell larry.martell@gmail.com wrote:
On Mon, Dec 9, 2013 at 8:00 AM, Fabrizio Di Carlo dicarlo.fabrizio@gmail.com 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...
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!
From: Larry Martell larry.martell@gmail.com
We have a python script that is currently run from cron. We want to make it into a service so it can be controlled with service start/stop/restart. Can anyone point me at site that has instructions on how to do this? I've googled but haven't found anything.
http://fedoraproject.org/wiki/Packaging:SysVInitScript
JD
On Mon, Dec 9, 2013 at 9:05 AM, John Doe jdmls@yahoo.com wrote:
From: Larry Martell larry.martell@gmail.com
We have a python script that is currently run from cron. We want to make it into a service so it can be controlled with service start/stop/restart. Can anyone point me at site that has instructions on how to do this? I've googled but haven't found anything.
Thanks!