athena-start 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. # athena starting script by rowla
  3. # modified by shazeya@syafi.com (NL101541)
  4. PATH=./:$PATH
  5. L_SRV=login-server
  6. C_SRV=char-server
  7. M_SRV=map-server
  8. print_start() {
  9. # more << EOF
  10. echo "Athena Starting..."
  11. echo " (c) 2003 Athena Project"
  12. echo " modified by shazeya@syafi.com"
  13. echo ""
  14. #echo "Debug informations will appear,"
  15. #echo "since this is a test release."
  16. #echo ""
  17. echo "checking..."
  18. #EOF
  19. }
  20. check_files() {
  21. for i in ${L_SRV} ${C_SRV} ${M_SRV}
  22. do
  23. if [ ! -f ./$i ]; then
  24. echo "$i does not exist, or can't run."
  25. echo "Stop. Check your compile."
  26. exit 1;
  27. fi
  28. done
  29. # more << EOF
  30. echo "Check complete."
  31. echo "Looks good, a nice Athena!"
  32. #EOF
  33. }
  34. case $1 in
  35. 'start')
  36. print_start
  37. check_files
  38. exec ./${L_SRV}&
  39. echo $! > .${L_SRV}.pid
  40. exec ./${C_SRV}&
  41. echo $! > .${C_SRV}.pid
  42. exec ./${M_SRV}&
  43. echo $! > .${M_SRV}.pid
  44. echo "Now Started Athena."
  45. ;;
  46. 'stop')
  47. for i in .${L_SRV}.pid .${C_SRV}.pid .${M_SRV}.pid
  48. do
  49. if [ -e ./$i ]; then
  50. kill $(cat $i)
  51. rm $i
  52. fi
  53. done
  54. ;;
  55. 'restart')
  56. $0 stop
  57. $0 start
  58. ;;
  59. *)
  60. echo "Usage: athena-start { start | stop | restart }"
  61. ;;
  62. esac