2017年1月2日 星期一

Supervisord on OpenWrt



# pip install supervisor


sample configuration file
# cp /usr/lib/python2.7/site-packages/supervisor/skel/sample.conf /etc/supervisord.conf

# vi /etc/init.d/supervisor
#!/bin/sh /etc/rc.common
#
# AUTHOR: Takumi Sueda
#
# Start/stop/restart supervisor in OpenWrt. START=91 USE_PROCD=0
PROG=/usr/bin/supervisord DAEMON=${PROG} # Location of the pid file
PIDFILE=/tmp/supervisord.pid # Config of supervisor
CONFIG=/etc/supervisord.conf start_service()
{
# $DAEMON -c $CONFIG -j $PIDFILE
procd_open_instance
procd_set_param command $PROG -c $CONFIG -j $PIDFILE
procd_set_param respawn
procd_close_instance
touch $CONFIG
} stop_service()
{
kill $(cat $PIDFILE)
}
# chmod u+x /etc/init.d/supervisor
# /etc/init.d/supervisor start

開機自動啓動
# cd /etc/rc.d
# ln -s ../init.d/supervisor S99supervisor

沒有留言:

張貼留言