标签:supervisor
比如logstash ,要允许一个命令如下:
nohup bin/logstash -f confs/zabbix.conf -l zabbix.log&
比如我想停止这个进程,那么我要先ps查进程然后再kill ,而且我又不喜欢screen那种方式,那么supervisor 就是解决方案了。
yum install supervisor
chkconfig supervisord on
/etc/supervisord.conf
只要program字段
启动2个进程,直接
/etc/init.d/supervisord start
下面是我跑logstash的配置
[program:logstash-zabbix]
directory=/opt/logstash
command=/opt/logstash/bin/logstash -f /opt/logstash/confs/zabbix.conf -l /opt/logstash/logs/zabbix.log
logfile=/opt/logstash/logs/zabbix.log
log_stderr=true
[program:logstash-redis]
command=/opt/logstash/bin/logstash -f /opt/logstash/confs/read-zabbixlog.conf -l /opt/logstash/logs/read-zabbix.log
logfile=/opt/logstash/logs/read-zabbix.log
log_stderr=true
如果想重启某个进程也是非常简单,
[root@moxx ~]# supervisorctl
logstash-redis RUNNING pid 21073, uptime 0:12:28
logstash-zabbix RUNNING pid 21074, uptime 0:12:28
supervisor> help
Documented commands (type help <topic>):
========================================
EOF exit maintail quit restart start stop
clear help open reload shutdown status tail
直接restart即可。
熟悉了以后基本上可以告别nohup了。
use supervisor instead of nohup
标签:supervisor
原文地址:http://blog.csdn.net/aca_jingru/article/details/46647615