linux shell 相关基础:
#!/bin/sh与#!/bin/bash的区别: http://blog.chinaunix.net/uid-27037833-id-3431985.html
#!/usr/bin/env 脚本解释程序的作用: http://selfcontroller.iteye.com/blog/2012385
awk命令: http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.html
for循环使用: http://blog.csdn.net/redhat456/article/details/6068409
echo使用: http://www.linuxidc.com/Linux/2014-10/107550.htm
下面为shutdown zabbix server脚本
#!/usr/bin/env bash ######################################### #######stop the process of zabbixServer ########################################## PATH=${PATH} export PATH ##get all process of zabbixServer echo stop zabbix Server... array=`ps aux | grep zabbix_server |awk '{print $2}'` for pid in ${array[@]} do echo -n ... kill -9 ${pid} > /dev/null 2>&1 sleep 2 done echo -e "\nSHUTDOWN OK"
zabbix agentd shutdown shell:
#!/usr/bin/env bash ######################################### #######stop the process of zabbix_agent ########################################## PATH=${PATH} export PATH ##get all process of zabbix_agent echo stop zabbix agentd... array=`ps aux | grep zabbix_agentd |awk '{print $2}'` for pid in ${array[@]} do echo -n ... kill -9 ${pid} > /dev/null 2>&1 sleep 2 done echo -e "\nSHUTDOWN OK"