Supervisord运行ssserver但在CentOS上报错?

Supervisord运行ssserver但在CentOS上报错?

我有以下 Supervisord 设置/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

之后一切就OK了。现在当我开始时shadowsocks

supervisorctl start shadowsocks

它报告一个错误:

shadowsocks: ERROR (abnormal termination)

但是如果我直接执行:

ssserver -c ~/config.json

效果很好。为什么这不能与 一起使用supervisord

答案1

AFAIK,supervisor不支持标题~扩展,~/config.json被视为文字。

您应该更改~/config.json其绝对路径/path/to/config.json并确保可以通过nobody.

有关主管配置的更多信息,请参阅这里

相关内容