本文共 615 字,大约阅读时间需要 2 分钟。
#!/bin/shmy_ip=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{print substr($2, index($2, ":")+1)}'`recv=""msg="not_existing, restart ..."MONITOR_LOG="monitor.log"#monitor procname scriptnamemonitor(){ # 查找进程 pgrep ^$1$ > /dev/null # 如果不存在, 就重启他. if [ $? -ne 0 ] ; then echo "`date` ${my_ip}.$1 $msg"; $2 restart fi sleep 2}echo "`date` monitor begin ..." >> ../log/monitor.logmonitor "server" "/home/rti/rti/scripts/Server.sh" >> ${MONITOR_LOG}monitor "connector" "/home/rti/rti/scripts/Connector.sh" >> ${MONITOR_LOG}echo "`date` monitor end ..." >> ../log/monitor.log
转载地址:http://apabb.baihongyu.com/