Guest User

Untitled

a guest
Jan 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: ocserv
  4. # Required-Start: $remote_fs $syslog
  5. # Required-Stop: $remote_fs $syslog
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. ### END INIT INFO
  9. # Copyright Rene Mayrhofer, Gibraltar, 1999
  10. # This script is distibuted under the GPL
  11.  
  12. PATH=/bin:/usr/bin:/sbin:/usr/sbin
  13. DAEMON=/usr/sbin/ocserv
  14. PIDFILE=/var/run/ocserv.pid
  15. DAEMON_ARGS="-c /etc/ocserv/ocserv.conf"
  16.  
  17. case "$1" in
  18. start)
  19. if [ ! -r $PIDFILE ]; then
  20. echo -n "Starting OpenConnect VPN Server Daemon: "
  21. start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
  22. $DAEMON_ARGS > /dev/null
  23. echo "ocserv."
  24. else
  25. echo -n "OpenConnect VPN Server is already running.\n\r"
  26. exit 0
  27. fi
  28. ;;
  29. stop)
  30. echo -n "Stopping OpenConnect VPN Server Daemon: "
  31. start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
  32. echo "ocserv."
  33. rm -f $PIDFILE
  34. ;;
  35. force-reload|restart)
  36. echo "Restarting OpenConnect VPN Server: "
  37. $0 stop
  38. sleep 1
  39. $0 start
  40. ;;
  41. status)
  42. if [ ! -r $PIDFILE ]; then
  43. # no pid file, process doesn't seem to be running correctly
  44. exit 3
  45. fi
  46. PID=`cat $PIDFILE | sed 's/ //g'`
  47. EXE=/proc/$PID/exe
  48. if [ -x "$EXE" ] &&
  49. [ "`ls -l \"$EXE\" | cut -d'>' -f2,2 | cut -d' ' -f2,2`" = \
  50. "$DAEMON" ]; then
  51. # ok, process seems to be running
  52. exit 0
  53. elif [ -r $PIDFILE ]; then
  54. # process not running, but pidfile exists
  55. exit 1
  56. else
  57. # no lock file to check for, so simply return the stopped status
  58. exit 3
  59. fi
  60. ;;
  61. *)
  62. echo "Usage: /etc/init.d/ocserv {start|stop|restart|force-reload|status}"
  63. exit 1
  64. ;;
  65. esac
  66.  
  67. exit 0
Add Comment
Please, Sign In to add comment