mapchecker.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. athena_dir="/home/athena/658/"
  3. while [ true ] ; do
  4. if [ ` ps fauxw | grep map-server | grep -v grep | wc -l ` -eq 0 ];then
  5. #echo `date` " -- map-server crashed - restarting"
  6. echo `date` " -- map-server crashed - restarting" >> /var/log/athena_status.log
  7. killall -9 map-server
  8. cd $athena_dir
  9. nohup ./map-server ./conf/map_athena.conf ./inter_athena.conf &
  10. sleep 240
  11. #sleep 40 #for fast pc's remove the "#" at the beginning of the line and delete the line above
  12. fi
  13. if [ ` ps fauxw | grep map-server | grep -v grep | awk '{print $3}' | awk 'BEGIN{FS="."} {print $1}' ` -gt 10 ];then
  14. #echo `date` " -- mapserver cpuload over 10 - restarting"
  15. echo `date` " -- mapserver cpuload over 10 - restarting" >> /var/log/athena_status.log
  16. killall -9 map-server
  17. cd $athena_dir
  18. nohup ./map-server ./conf/map_athena.conf ./inter_athena.conf &
  19. sleep 240
  20. #sleep 40 #for fast pc's remove the "#" at the beginning of the line and delete the line above
  21. #echo `date` " -- restarted"
  22. echo `date` " -- restarted" >> /var/log/athena_status.log
  23. fi
  24. if [ ` ps fauxw | grep char-server | grep -v grep | wc -l ` -eq 0 ];then
  25. #echo `date` " -- char server crashed - restarting"
  26. echo `date` " -- char server crashed - restarting" >> /var/log/athena_status.log
  27. killall -9 char-server
  28. cd $athena_dir
  29. nohup ./char-server ./conf/char_athena.conf ./conf/inter_athena.conf &
  30. #echo `date` " -- restarted"
  31. echo `date` " -- restarted" >> /var/log/athena_status.log
  32. fi
  33. if [ ` ps fauxw | grep login-server | grep -v grep | wc -l ` -eq 0 ];then
  34. #echo `date` " -- login server crashed - restarting"
  35. echo `date` " -- login server crashed - restarting" >> /var/log/athena_status.log
  36. killall -9 login-server
  37. cd $athena_dir
  38. nohup ./login-server ./conf/login_athena.conf &
  39. #echo `date` " -- restarted"
  40. echo `date` " -- restarted" >> /var/log/athena_status.log
  41. fi
  42. #echo `date` " -- everything is fine"
  43. echo `date` " -- everything is fine" >> /var/log/athena_status.log
  44. sleep 30
  45. done