スタートからスーパーバイザサービスの起動

問題を解決するために、

私たちは使用することができ、マシン上でサービスを展開するために書かれているSupervisor、自動的に再起動サービスに住むプロセス検査ツールとして。
マシンをリブートするには、スーパーバイザーが自動的に再起動できない場合でも、その後、誰がこの問題を解決するために起こっていますか?

答えは、サービスのlinuxということです。

概念

実行するためにサービス+スクリプト名、その後、スクリプトを記述し、/etc/init.dディレクトリに置きます。それは、スタートアップのchkconfigコマンドでそれを使用する必要がある場合。

あまり話をしなかった、始めるためにそれを行います!

インストール方法

増加のサービス設定

[root@hdx9whvy init.d]# vim /etc/init.d/supervisor

コンテンツ

#!/bin/bash
#
# supervisord   This scripts turns supervisord on
#
# Author:       Mike McGrath <[email protected]> (based off yumupdatesd)
#
# chkconfig:    - 95 04
#
# description:  supervisor is a process control utility.  It has a web based
#               xmlrpc interface as well as a few other nifty features.
# processname:  supervisord
# config: /etc/supervisor/supervisord.conf
# pidfile: /var/run/supervisord.pid
#

# source function library
. /etc/rc.d/init.d/functions

RETVAL=0

start() {
    echo -n $"Starting supervisord: "
    daemon "/usr/bin/supervisord -c /etc/supervisord.conf"
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/supervisord
}

stop() {
    echo -n $"Stopping supervisord: "
    killproc supervisord
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/supervisord
}

restart() {
    stop
    start
}

case "$1" in
  start)
    start
    ;;
  stop) 
    stop
    ;;
  restart|force-reload|reload)
    restart
    ;;
  condrestart)
    [ -f /var/lock/subsys/supervisord ] && restart
    ;;
  status)
    status supervisord
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
    exit 1
esac

exit $RETVAL

セットアップスクリプトの実行

[root@hdx9whvy init.d]# chmod +x /etc/init.d/supervisor

設定サービスの起動

  • このコマンドは切り替わりませんが、多くの場合、即時効果を持つサービスですが、再起動後にサービスがデフォルトの状態に戻ります。
  • 自動的にブートリストに追加したサービス用のchkconfig、ちょうどそれを起動し、あなたは永久に再起動後に自動的に起動することができますが
[root@hdx9whvy init.d]# chkconfig supervisor on

スタートとストップコマンド

[root@hdx9whvy init.d]# service supervisor start
Starting supervisord:                                      [  OK  ]

[root@hdx9whvy init.d]# service supervisor stop
Stopping supervisord:                                      [  OK  ]

[root@hdx9whvy ~]# service supervisor restart
Stopping supervisord:                                      [  OK  ]
Starting supervisord:                                      [  OK  ]

おすすめ

転載: www.cnblogs.com/laolieren/p/restart_supervisor_when_reboot_system.html