Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

start-stop-daemon and python

I'm trying to start python script with start-stop-daemon:

sudo /sbin/start-stop-daemon --start --pidfile /home/loop.pid \ 
--user www-data --group www-data -b --make-pidfile --chuid www-data \
--exec /usr/bin/python /home/loop.py --verbose

but no python script in my processes. What i do wrong?

loop.py:

import time
while True:
    print "working..."
    time.sleep(3)
like image 735
evg Avatar asked Dec 20 '11 16:12

evg


1 Answers

I tried your script and command line, and it is working on my machine. Are you sure your script is located at /home/loop.py?

Also, don't expect to see those prints, because you are specifying the -b (background) option, so the process is being detached from your terminal. Try running it without the -b for testing purposes and then you can redirect the standard output to a logfile with the -stdout option:

sudo /sbin/start-stop-daemon --start --pidfile /home/loop.pid \ 
--user www-data --group www-data -b --make-pidfile --chuid www-data \
--exec /usr/bin/python /home/loop.py --verbose -stdout /var/log/loop.log
like image 134
Chewie Avatar answered Sep 29 '22 23:09

Chewie