#!/usr/bin/env bash

#该脚本的作用是：监控线上服务器supervisor 进程工作是否正常

gearadmin --status |awk '{print $4}' > /tmp/txt

for i in $(cat /tmp/txt) ;do
SUPERVISORD=$(ps aux|grep supervisord |grep -v grep |wc -l)
	if [ $SUPERVISORD = 0 ];then
		/usr/bin/supervisord -c /etc/supervisord.conf >> /root/wx_work.log
	fi
	
	if [ $i = 0 ] ;then
			supervisorctl restart all
	fi
done

