1

I have the following Supervisord setup, /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

I then do the following to set it up and start it:

$ sudo chmod +x /etc/rc.d/init.d/supervisord
$ sudo chkconfig --add supervisord
$ sudo chkconfig supervisord on
$ sudo service supervisord start

Afterwards everything is OK. Now when I start shadowsocks:

supervisorctl start shadowsocks

It reports an error:

shadowsocks: ERROR (abnormal termination)

However if I executes directly:

ssserver -c ~/config.json

it works well. Why won't this work with supervisord?

1

AFAIK, supervisor does not support tidle ~ expansion, ~/config.json is treated as literal.

You should change ~/config.json to its absolute path /path/to/config.json and make sure it can be accessed by nobody.

More about supervisor configuration, see here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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