这是我的代码:
#!/bin/bash
daemon="$APPVENV/bin/uwsgi"
args="--emperor $APPCONF/uwsgi/app.ini"
pid="$APPDIR/emperor.pid"
case "\$1" in
start)
echo "Starting uwsgi"
start-stop-daemon -m -p \$pid --start --exec \$daemon -- \$args
;;
stop)
echo "Stopping script uwsgi"
start-stop-daemon --signal INT -p \$pid --stop \$daemon -- \$args
;;
reload)
echo "Reloading conf"
kill -HUP \$(< \$pid)
;;
*)
echo "Usage: /etc/init.d/uwsgi {start|stop|reload}"
exit 1
;;
esac
exit 0
当我尝试使用它时,它说我缺少 LSB 标签和覆盖。我在 Google 上搜索并找到了以下示例:
### BEGIN INIT INFO
# Provides: scriptname
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
不过,我感到很困惑,首先,remote_fs 和 syslog 变量,我需要保留这些变量作为默认值吗?其次,我怎么知道应该为默认启动和停止设置什么数字?