如何configuration较新版本的Supervisord以在Ubuntu 12.02系统启动时启动?

你如何configuration一个更新版本的主pipe在Ubuntu启动系统启动? 一些发行版在它们的版本库中只是滞后。

当我使用简单的安装(在主pipe网站上默认推荐)我只能得到二进制安装,但它不是守护进程

http://supervisord.org/installing.html

有一个以前的老post提到创build一个新贵或一个systemd脚本,有多个人尝试不同的事情,让它的工作,但没有明确的答案。

如何自动启动Linux上的supervisord(Ubuntu)

尽pipe文档列表使用easy_install来设置pipe理员,但它也显示了其他方法,比如使用一个包。 软件包的限制是你依赖于分配滞后于主pipe开发周期的分配。 这是一个解决方法,依赖于添加一个外部存储库到您的发行版。 如果你认为这是一个不行,那就考虑升级你的发行版。 如果你感兴趣的是System V init.d脚本,请转到post的底部。 有一个链接到社区支持不同的发行版,包括Ubuntu的脚本列表。

经过一番研究之后,我发现安装Supervisor的步骤是deamonize,并在Ubuntu 12.04中添加一个默认的supervisord.conf文件,该文件的版本库中有一个老版本的supervisor。

1.添加主pipePPA存储库:

sudo apt-add-repository ppa:schooltool-owners/trunk 

如果apt-add-repository二进制文件不存在,则将其从现有的Universe中添加。

1.a(可能有必要)来源: https : //askubuntu.com/questions/38021/how-to-add-a-ppa-on-a-server

  sudo apt-get install software-properties-common sudo apt-get install python-software-properties 

2.-使用apt-get安装Supervisor

  sudo apt-get install supervisor 

3.检查一个脚本的init.d目录。 你应该得到这样的东西:

  #! /bin/sh # # skeleton example file to build /etc/init.d/ scripts. # This file should be used to construct scripts for /etc/init.d. # # Written by Miquel van Smoorenburg <[email protected]>. # Modified for Debian # by Ian Murdock <[email protected]>. # Further changes by Javier Fernandez-Sanguino <[email protected]> # # Version: @(#)skeleton 1.9 26-Feb-2001 [email protected] # ### BEGIN INIT INFO # Provides: supervisor # Required-Start: $remote_fs $network $named # Required-Stop: $remote_fs $network $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/stop supervisor # Description: Start/stop supervisor daemon and its configured # subprocesses. ### END INIT INFO . /lib/lsb/init-functions PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/supervisord NAME=supervisord DESC=supervisor test -x $DAEMON || exit 0 LOGDIR=/var/log/supervisor PIDFILE=/var/run/$NAME.pid DODTIME=5 # Time to wait for the server to die, in seconds # If this value is set too low you might not # let some servers to die gracefully and # 'restart' will not work # Include supervisor defaults if available if [ -f /etc/default/supervisor ] ; then . /etc/default/supervisor fi DAEMON_OPTS="-c /etc/supervisor/supervisord.conf $DAEMON_OPTS" set -e running_pid() { # Check if a given process pid's cmdline matches a given name pid=$1 name=$2 [ -z "$pid" ] && return 1 [ ! -d /proc/$pid ] && return 1 (cat /proc/$pid/cmdline | tr "\000" "\n"|grep -q $name) || return 1 return 0 } running() { # Check if the process is running looking at /proc # (works for all users) # No pidfile, probably no daemon present [ ! -f "$PIDFILE" ] && return 1 # Obtain the pid and check it against the binary name pid=`cat $PIDFILE` running_pid $pid $DAEMON || return 1 return 0 } force_stop() { # Forcefully kill the process [ ! -f "$PIDFILE" ] && return if running ; then kill -15 $pid # Is it really dead? [ -n "$DODTIME" ] && sleep "$DODTIME"s if running ; then kill -9 $pid [ -n "$DODTIME" ] && sleep "$DODTIME"s if running ; then echo "Cannot kill $LABEL (pid=$pid)!" exit 1 fi fi fi rm -f $PIDFILE return 0 } case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --quiet --pidfile $PIDFILE \ --startas $DAEMON -- $DAEMON_OPTS test -f $PIDFILE || sleep 1 if running ; then echo "$NAME." else echo " ERROR." fi ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE echo "$NAME." ;; force-stop) echo -n "Forcefully stopping $DESC: " force_stop if ! running ; then echo "$NAME." else echo " ERROR." fi ;; #reload) # # If the daemon can reload its config files on the fly # for example by sending it SIGHUP, do it here. # # If the daemon responds to changes in its config file # directly anyway, make this a do-nothing entry. # # echo "Reloading $DESC configuration files." # start-stop-daemon --stop --signal 1 --quiet --pidfile \ # /var/run/$NAME.pid --exec $DAEMON #;; force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart" except that it does nothing if the # daemon isn't already running. # check wether $DAEMON is running. If so, restart start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \ --startas $DAEMON \ && $0 restart \ || exit 0 ;; restart) echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE [ -n "$DODTIME" ] && sleep $DODTIME start-stop-daemon --start --quiet --pidfile $PIDFILE \ --startas $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; status) echo -n "$LABEL is " if running ; then echo "running" else echo " not running." exit 1 fi ;; *) N=/etc/init.d/$NAME # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2 exit 1 ;; esac exit 0 

更多细节在这里: https : //github.com/Supervisor/initscripts

在这里: http : //supervisord.org/running.html