1
0

pptpd.init 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: pptpd
  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. PATH=/bin:/usr/bin:/sbin:/usr/sbin
  12. DAEMON=/usr/sbin/pptpd
  13. PIDFILE=/var/run/pptpd.pid
  14. FLAGS="defaults 50"
  15. case "$1" in
  16. start)
  17. echo -n "Starting PPTP Daemon: "
  18. start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
  19. -- < /dev/null > /dev/null
  20. echo "pptpd."
  21. ;;
  22. stop)
  23. echo -n "Stopping PPTP: "
  24. start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
  25. echo "pptpd."
  26. ;;
  27. force-reload|restart)
  28. echo "Restarting PPTP: "
  29. sh $0 stop
  30. sh $0 start
  31. ;;
  32. status)
  33. if [ ! -r $PIDFILE ]; then
  34. # no pid file, process doesn't seem to be running correctly
  35. exit 3
  36. fi
  37. PID=`cat $PIDFILE | sed 's/ //g'`
  38. EXE=/proc/$PID/exe
  39. if [ -x "$EXE" ] &&
  40. [ "`ls -l \"$EXE\" | cut -d'>' -f2,2 | cut -d' ' -f2,2`" = \
  41. "$DAEMON" ]; then
  42. # ok, process seems to be running
  43. exit 0
  44. elif [ -r $PIDFILE ]; then
  45. # process not running, but pidfile exists
  46. exit 1
  47. else
  48. # no lock file to check for, so simply return the stopped status
  49. exit 3
  50. fi
  51. ;;
  52. *)
  53. echo "Usage: /etc/init.d/pptpd {start|stop|restart|force-reload|status}"
  54. exit 1
  55. ;;
  56. esac
  57. exit 0