vpnserver 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/sh
  2. #
  3. # vpnserver This shell script takes care of starting and stopping
  4. # SoftEther VPN server.
  5. #
  6. # chkconfig: - 99 1
  7. # description: SoftEther VPN server.
  8. #
  9. ### BEGIN INIT INFO
  10. # Provides: vpnserver
  11. # Required-Start: $local_fs $network
  12. # Required-Stop: $local_fs $network
  13. # Short-Description: start and stop SoftEther VPN server.
  14. # Description: SoftEther VPN server.
  15. ### END INIT INFO
  16. # Source function library.
  17. . /etc/rc.d/init.d/functions
  18. exec="/usr/vpnserver/vpnserver"
  19. prog="vpnserver"
  20. #config="<path to major config file>"
  21. #[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
  22. pidfile=/usr/vpnserver/.pid_3E649A678269D4A01B73BF9E3388D075
  23. lockfile=/var/lock/subsys/$prog
  24. start() {
  25. [ -x $exec ] || exit 5
  26. # [ -f $config ] || exit 6
  27. echo -n $"Starting $prog: "
  28. $exec start
  29. retval=$?
  30. echo
  31. [ $retval -eq 0 ] && touch $lockfile
  32. return $retval
  33. }
  34. stop() {
  35. echo -n $"Stopping $prog: "
  36. $exec stop
  37. retval=$?
  38. echo
  39. [ $retval -eq 0 ] && rm -f $lockfile
  40. return $retval
  41. }
  42. restart() {
  43. stop
  44. start
  45. }
  46. reload() {
  47. restart
  48. }
  49. force_reload() {
  50. restart
  51. }
  52. rh_status() {
  53. status -p $pidfile $prog
  54. }
  55. rh_status_q() {
  56. rh_status >/dev/null 2>&1
  57. }
  58. case "$1" in
  59. start)
  60. rh_status_q && exit 0
  61. $1
  62. ;;
  63. stop)
  64. rh_status_q || exit 0
  65. $1
  66. ;;
  67. restart)
  68. $1
  69. ;;
  70. reload)
  71. rh_status_q || exit 7
  72. $1
  73. ;;
  74. force-reload)
  75. force_reload
  76. ;;
  77. status)
  78. rh_status
  79. ;;
  80. condrestart|try-restart)
  81. rh_status_q || exit 0
  82. restart
  83. ;;
  84. *)
  85. echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
  86. exit 2
  87. esac
  88. exit $?