使用supervieord管理logstash进程

2017-01-11  本文已影响0人  梦想做小猿

说明

logstash一般在命令行加指定配置文件加上nohup和&来后台运行,正式环境这种做法不符合规范,而且配置文件多了,不方便管理,所以使用supervieord来统一管理logstash

supervieord安装

  #!/bin/sh
  #
  # /etc/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/bin"
  exec_prefix="${prefix}"
  prog_bin="${exec_prefix}/supervisord"
  PIDFILE="/var/run/$prog.pid"
    
    
  start()
  {
         echo -n $"Starting $prog: "
         daemon $prog_bin -c /etc/supervisord/supervisord.conf --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
上一篇 下一篇

猜你喜欢

热点阅读