1 | #!/bin/bash |
---|
2 | |
---|
3 | athena_dir="/home/athena/658/" |
---|
4 | |
---|
5 | while [ true ] ; do |
---|
6 | |
---|
7 | if [ ` 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 |
---|
15 | fi |
---|
16 | |
---|
17 | |
---|
18 | if [ ` 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 |
---|
28 | fi |
---|
29 | |
---|
30 | if [ ` 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 | |
---|
39 | fi |
---|
40 | |
---|
41 | if [ ` 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 | |
---|
50 | fi |
---|
51 | |
---|
52 | |
---|
53 | #echo `date` " -- everything is fine" |
---|
54 | echo `date` " -- everything is fine" >> /var/log/athena_status.log |
---|
55 | sleep 30 |
---|
56 | done |
---|