1. 程式人生 > >zabbix客戶端服務開啟關閉指令碼

zabbix客戶端服務開啟關閉指令碼

$cat zabbix_agentd.sh 

#!/bin/bash
start_sh="/usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf"
if [ "$1" == "restart" ];then
	a=`ps aux | grep "zabbix_agentd\ " | awk '{print $2}'`
	if [ "$a" != "" ];then
		kill $a
	fi
	$start_sh
elif [ "$1" == "start" ];then
	$start_sh
elif [ "$1" == "stop" ];then
	a=`ps aux | grep "zabbix_agentd\ " | awk '{print $2}'`
    if [ "$a" != "" ];then
		kill $a
    fi
fi