1
0

pptpd.init 1.4 KB

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