I'm trying to run my python script as a service… But I'm getting this error when I call sudo update-rc.d mylistener start
:
Use of uninitialized value $ARGV[1] in pattern match (m//) at /usr/sbin/update-rc.d line 192.
update-rc.d: error: expected NN after start
Here is my init script mylistener
:
#! /bin/sh
### BEGIN INIT INFO
# Provides: mylistener
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: This is the description.
# Description: This is the description.
### END INIT INFO
DAEMON=/srv/example.org/public/env/bin/python
ARGS=/srv/example.org/public/my_listener.py
PIDFILE=/srv/example.org/my_listener.pid
case "$1" in
start)
echo "starting server"
/sbin/start-stop-daemon --start --pidfile $PIDFILE \
--user www-data --group www-data \
-b --make-pidfile \
--chuid www-data \
--exec $DAEMON $ARGS
;;
stop)
echo "stopping server"
/sbin/start-stop-daemon --stop --pidfile $PIDFILE --verbose
;;
*)
echo "Useage: /etc/init.d/mylistener {start|stop}"
exit 1
;;
esac
exit 0
Can anyone see where I'm going wrong? This is running on a debian server.
Best Answer
Try this:
it means that your init script will be start at 20th order, runlevel 2345 and stop at 80th priority, runlevel 016.
or simple is: