athena-start 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/sh
  2. # athena starting script by rowla
  3. PATH=./:$PATH
  4. L_SRV=login-server
  5. C_SRV=char-server
  6. M_SRV=map-server
  7. L_SRV_C=./conf/login_athena.conf
  8. C_SRV_C=./conf/char_athena.conf
  9. C_SRV_C2=./conf/inter_athena.conf
  10. M_SRV_C=./conf/map_athena.conf
  11. M_SRV_C2=./conf/battle_athena.conf
  12. M_SRV_C3=./conf/atcommand_athena.conf
  13. M_SRV_C4=./conf/script_athena.conf
  14. M_SRV_C5=./conf/msg_athena.conf
  15. M_SRV_C6=./conf/grf-files.txt
  16. print_start() {
  17. # more << EOF
  18. echo "Athena Starting..."
  19. echo " (c) 2003 Athena Project."
  20. echo " URL:http://project-yare.de/"
  21. echo ""
  22. echo "Debug informations will appear,"
  23. echo "since this is a test release."
  24. echo ""
  25. echo "checking..."
  26. #EOF
  27. }
  28. check_account() {
  29. if [ ! -f ./save/account.txt ]; then
  30. echo "0 s1 p1 - S 0" > save/account.txt
  31. echo "1 s2 p2 - S 0" >>save/account.txt
  32. echo "2 s3 p3 - S 0" >>save/account.txt
  33. echo "3 s4 p4 - S 0" >>save/account.txt
  34. echo "4 s5 p5 - S 0" >>save/account.txt
  35. fi
  36. }
  37. check_files() {
  38. for i in ${L_SRV} ${C_SRV} ${M_SRV} ${L_SRV_C} ${C_SRV_C} ${C_SRV_C2} ${M_SRV_C} ${M_SRV_C2} ${M_SRV_C3} ${M_SRV_C4} ${M_SRV_C5} ${M_SRV_C6}
  39. do
  40. if [ ! -f ./$i ]; then
  41. echo "$i does not exist, or can't run."
  42. echo "Stoped, Check your compile or configuration file."
  43. exit 1;
  44. fi
  45. done
  46. # more << EOF
  47. echo "Check done."
  48. echo "Looks good, have a nice athena!"
  49. #EOF
  50. }
  51. case $1 in
  52. 'start')
  53. print_start
  54. check_account
  55. check_files
  56. exec ./${L_SRV} ${L_SRV_C}&
  57. # exec ./${C_SRV} ${C_SRV_C} ${C_SRV_C2} > /dev/null&
  58. # exec ./${M_SRV} ${M_SRV_C} ${M_SRV_C2} > /dev/null&
  59. exec ./${C_SRV} ${C_SRV_C} ${C_SRV_C2}&
  60. exec ./${M_SRV} ${M_SRV_C} ${M_SRV_C2} ${M_SRV_C3} ${M_SRV_C4} ${M_SRV_C5} ${M_SRV_C6}&
  61. echo "Now Started Athena."
  62. ;;
  63. 'stop')
  64. ps ax | grep -E "${L_SRV}|${C_SRV}|${M_SRV}" | awk '{print $1}' | xargs kill -9
  65. ;;
  66. 'restart')
  67. $0 stop
  68. $0 start
  69. ;;
  70. *)
  71. echo "Usage: athena-start { start | stop | restart }"
  72. ;;
  73. esac