root/tools/mapchecker.sh @ 15

Revision 1, 2.2 kB (checked in by jinshiro, 17 years ago)
Line 
1#!/bin/bash
2
3athena_dir="/home/athena/658/"
4
5while [ true ] ; do
6
7if [ ` ps fauxw | grep map-server | grep -v grep | wc -l ` -eq 0 ];then
8        #echo `date` " -- map-server crashed - restarting"
9        echo `date` " -- map-server crashed - restarting" >> /var/log/athena_status.log
10        killall -9 map-server
11        cd $athena_dir
12        nohup ./map-server ./conf/map_athena.conf ./inter_athena.conf &
13        sleep 240
14        #sleep 40 #for fast pc's remove the "#" at the beginning of the line and delete the line above
15fi
16
17
18if [ ` ps fauxw | grep map-server | grep -v grep | awk '{print $3}' | awk 'BEGIN{FS="."} {print $1}' ` -gt 10 ];then
19        #echo `date` " -- mapserver cpuload over 10 - restarting"
20        echo `date` " -- mapserver cpuload over 10 - restarting" >> /var/log/athena_status.log
21        killall -9 map-server
22        cd $athena_dir
23        nohup ./map-server ./conf/map_athena.conf ./inter_athena.conf &
24        sleep 240
25        #sleep 40 #for fast pc's remove the "#" at the beginning of the line and delete the line above
26        #echo `date` " -- restarted"
27        echo `date` " -- restarted" >> /var/log/athena_status.log
28fi
29
30if [ ` ps fauxw | grep char-server | grep -v grep | wc -l ` -eq 0 ];then
31        #echo `date` " -- char server crashed - restarting"
32        echo `date` " -- char server crashed - restarting" >> /var/log/athena_status.log
33        killall -9 char-server
34        cd $athena_dir
35        nohup ./char-server ./conf/char_athena.conf ./conf/inter_athena.conf &
36        #echo `date` " -- restarted"
37        echo `date` " -- restarted" >> /var/log/athena_status.log
38
39fi
40
41if [ ` ps fauxw | grep login-server | grep -v grep | wc -l ` -eq 0 ];then
42        #echo `date` " -- login server crashed - restarting"
43        echo `date` " -- login server crashed - restarting" >> /var/log/athena_status.log
44        killall -9 login-server
45        cd $athena_dir
46        nohup ./login-server ./conf/login_athena.conf &
47        #echo `date` " -- restarted"
48        echo `date` " -- restarted" >> /var/log/athena_status.log
49
50fi
51
52
53#echo `date` " -- everything is fine"
54echo `date` " -- everything is fine" >> /var/log/athena_status.log
55sleep 30
56done
Note: See TracBrowser for help on using the browser.