顯示具有 supervisor 標籤的文章。 顯示所有文章
顯示具有 supervisor 標籤的文章。 顯示所有文章

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

2014年12月30日 星期二

Python get supervisord process Info

import xmlrpclib
server = xmlrpclib.Server('http://localhost:9001/RPC2')
status_response = server.supervisor.getAllProcessInfo()
print status_response




References :
XML-RPC API Documentation — Supervisor 3.1.3 documentation

2014年8月23日 星期六

Supervisord log rotation settings

// logfile-maxbytes 爲單個檔案的記錄大小,超過的會 rotate 成備份檔,設爲 0 的話則所有 log 保存在同一個檔案
logfile-maxbytes = 20MB
// logfile-backups 爲 log 檔案的個數,設爲 0 的話則只保留一個,其他則予以刪除
logfile-backups = 5
// stdout 與 stderr 也可獨立設定
stdout_logfile_maxbytes
stdout_logfile_backups
stderr_logfile_maxbytes
stderr_logfile_backups




References :
php - Supervisord log file rotation settings - Stack Overflow

2014年8月11日 星期一

Error: .ini file does not include supervisorctl section

Error: .ini file does not include supervisorctl section
For help, use /usr/bin/supervisorctl -h

# supervisorctl -c <(echo "[supervisorctl]") status




References :
plope - supervisorctl should be able to operate without a .conf file