#!/bin/bash #update time 2011-10-10 ################################# gametype='jx2' gsdir='/home/xmission/jxonline2/gs' gs=(1 2 3 4) ################################## gscount=${#gs[@]} pr_id=`ps auxww |grep ${gsdir} |grep -v grep |wc -l` time=`date '+%F %T'` status=`curl --connect-timeout 30 -s "http://0.0.0.0/getcurrentoper.php?game=${gametype}"` if [ "${status}" == "1" ] then exit 1 fi if [ "$pr_id" == ${gscount} ] then curl --connect-timeout 30 -s "http://0.0.0.0/submitalarmstate.php?game=${gametype}&type=PROCESS&state=OK" 1> /dev/null 2> /dev/null exit 0 else for i in "${gs[@]}"; do per_id=`ps auxww |grep ${gsdir}$i |grep -v grep |wc -l` sleep 5 per_id1=`ps auxww |grep ${gsdir}$i |grep -v grep |wc -l` if [ "$per_id" != "1" -a "$per_id1" != "1" ] then curl --connect-timeout 30 -s "http://0.0.0.0/submitalarmstate.php?game=${gametype}&type=PROCESS&state=ALARM&description=gs${i}down" 1> /dev/null 2> /dev/null echo "${time} gs${i} down" |tee -a monitor_gs.log sh -c cd ${gsdir}$i && ./SO2GameSvrD 1> gs.log 2> gs.err & 2>&1;echo KNOSE-SHELL-END fi done fi
自動拉起腳本 auto_start_v2.sh
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.