

请根据自己实际路径修改第二行路径即可
#!/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
暂无评论内容