码迷,mamicode.com
首页 > 其他好文 > 详细

use supervisor instead of nohup

时间:2015-06-26 13:01:50      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:supervisor

use supervisor instead of nohup

比如logstash ,要允许一个命令如下:

nohup bin/logstash -f confs/zabbix.conf -l zabbix.log&

比如我想停止这个进程,那么我要先ps查进程然后再kill ,而且我又不喜欢screen那种方式,那么supervisor 就是解决方案了。

supervisor 安装

yum install supervisor
chkconfig  supervisord on

supervisor 配置

/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即可。

End

熟悉了以后基本上可以告别nohup了。

use supervisor instead of nohup

标签:supervisor

原文地址:http://blog.csdn.net/aca_jingru/article/details/46647615

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!