zabbix_agented启动关闭重启脚本

本站所有内容来自互联网收集,仅供学习和交流,请勿用于商业用途。如有侵权、不妥之处,请第一时间联系我们删除!Q群:迪思分享

请根据自己实际路径修改第二行路径即可

#!/bin/bash pfurl=/usr/local/sbin/zabbix_agentd -c /usr/local/etc/zabbix_agentd.conf PID=0 kill_zabbix_agentd(){ ps aux | awk -r /zabbix_agentd/{print $2} | xargs -n1 –exec kill{} &> /dev/null }pfstart(){ num=`ps aux | awk -r /zabbix_agentd/{print $2} | wc -l` if [ $num != “1” ];then echo “zabbix_agentd is useing” else echo “zabbix_agentd is starting…” $pfurl echo “start done!” fi } if [ $1 == “-s” ];then if [ $2 == “stop” ];then echo “zabbix_agentd is stopping….” kill_zabbix_agentd echo “stop done!” elif [ $2 == “start” ];then pfstart elif [ $2 == “restart” ];then echo “zabbix_agentd is stopping….” kill_zabbix_agentd echo “stop done!” echo “zabbix_agentd is starting…” $pfurl echo “start done!” fi elif [ $1 == “–help” ];then echo “zabbix_agentd -s [start/stop/restart]” else pfstart fi


© 版权声明
THE END
★喜欢这篇文章吗?喜欢的话,麻烦动动手指支持一下!★
点赞14 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容