我试图运行我的python脚本作为服务…但是当我打电话给sudo update-rc.d mylistener start时出现这个错误:
在/usr/sbin/update-rc.d第192行的模式匹配(m //)中使用未初始化的值$ ARGV [1]。
update-rc.d:错误:启动后预期的NN
这是我的初始化脚本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
任何人都可以看到我要去哪里错了? 这在debian服务器上运行。
尝试这个:
sudo update-rc.d mylistener start 20 2 3 4 5 . stop 80 0 1 6 .
这意味着你的初始化脚本将会从第20层开始,运行级2345,并停止在第80层,运行级016。
或简单的是:
sudo update-rc.d mylistener defaults