/etc/supervisord.conf
...
[program:shadowsocks]
command=ssserver -c ~/config.json
autorestart=true
user=nobody
...
/etc/rc.d/init.d/supervisord
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
# description: Supervisor Server
# processname: supervisord
# Source init functions
. /etc/rc.d/init.d/functions
prog="supervisord"
prefix="/usr/"
exec_prefix="${prefix}"
prog_bin="${exec_prefix}/bin/supervisord"
PIDFILE="/var/run/$prog.pid"
start()
{
echo -n $"Starting $prog: "
daemon $prog_bin --pidfile $PIDFILE
[ -f $PIDFILE ] && success $"$prog startup" || failure $"$prog startup"
echo
}
stop()
{
echo -n $"Shutting down $prog: "
[ -f $PIDFILE ] && killproc $prog || success $"$prog shutdown"
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
;;
esac
然后
sudo chmod +x /etc/rc.d/init.d/supervisord
sudo chkconfig --add supervisord
sudo chkconfig supervisord on
sudo service supervisord start
一切都很好
supervisorctl start shadowsocks
报告错误
shadowsocks: ERROR (abnormal termination)
但如果我直接执行
ssserver -c ~/config.json
效果很好
您的评论欢迎
答案 0 :(得分:0)
由于您已将运行用户的主管程序设置为nobody
并使用~/
,这是您的操作系统中当前用户的$HOME
目录的缩写,配置不正确
将配置设置为:
```
[program:shadowsocks]
command=/path/to/ssserver -c /path/to/config.json
autorestart=true
user=nobody
```
另外,请确保任何用户都有权运行ssserver
文件,并且可以阅读config.json
文件。
完成所有这些后,运行命令sudo supervisorctl reload
。
那将是有效的。
很高兴不仅中国人正在使用shadowocks。
与主管和shadowsocks一起玩。