I have a script and I need him to pass arguments to python program. I take arguments:
DAEMON_ARGS=""
start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --startas $DAEMON \
$DAEMON_ARGS \
|| return 2
Where $DAEMON is path to my .py file. I need to pass some numeric arguments like this
sudo /etc/init.d/sleepdaemon start 10
And this number I must pass to sleep.py. The code of sleep.py:
#! env/bin python
import time
sleep(n)
How do I make n = 10(the argument that wass pass from console) ?
First, add the arguments to your daemon invocation:
Second, consume them in your python program:
Look here for more detailed information about command line arguments use in Python.