Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
# 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.


case "$1" in
    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
    echo "stopping server"
    /sbin/start-stop-daemon --stop --pidfile $PIDFILE --verbose
    echo "Useage: /etc/init.d/mylistener {start|stop}"
    exit 1

exit 0

Can anyone see where I'm going wrong? This is running on a debian server.

share|improve this question
up vote 4 down vote accepted

Try this:

sudo update-rc.d mylistener start 20 2 3 4 5 . stop 80 0 1 6 .

it means that your init script will be start at 20th order, runlevel 2345 and stop at 80th priority, runlevel 016.

or simple is:

sudo update-rc.d mylistener defaults
share|improve this answer
If I run sudo update-rc.d mylistener start 20 3 5 . I get Adding system startup for /etc/init.d/mylistener but I cannot see where it's running and it doesn't appear to run either. – ing0 Oct 25 '11 at 10:53
What happen if you run /etc/init.d/mylistener start and verify it is running with ps -ef | grep mylistener? – quanta Oct 25 '11 at 10:57
james 27380 20728 0 12:00 pts/1 00:00:00 grep mylistener – ing0 Oct 25 '11 at 11:01
Ah thanks, it's working now :) I must have not tried starting it like that! – ing0 Oct 25 '11 at 11:05
I've just noticed that by running it without update-rc.d, it (obviously) doesn't auto run on boot. How can I set it up to do this? – ing0 Oct 27 '11 at 14:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.