File: pptpd.init

package info (click to toggle)
pptpd 1.3.0-2etch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 1,036 kB
  • ctags: 856
  • sloc: ansic: 5,338; sh: 613; perl: 157; makefile: 130
file content (53 lines) | stat: -rw-r--r-- 1,366 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# Copyright Rene Mayrhofer, Gibraltar, 1999
# This script is distibuted under the GPL

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/pptpd
PIDFILE=/var/run/pptpd.pid
FLAGS="defaults 50"

case "$1" in
  start)
    echo -n "Starting PPTP Daemon: "
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
    	-- < /dev/null > /dev/null
    echo "pptpd."
    ;;
  stop)
    echo -n "Stopping PPTP: "
    start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
    echo "pptpd."
    ;;
  force-reload|restart)
    echo "Restarting PPTP: "
    sh $0 stop
    sh $0 start
    ;;
    status)
    	if [ ! -r $PIDFILE ]; then
            # no pid file, process doesn't seem to be running correctly
            exit 3
        fi
    	PID=`cat $PIDFILE | sed 's/ //g'`
        EXE=/proc/$PID/exe
        if [ -x "$EXE" ] && 
        	[ "`ls -l \"$EXE\" | cut -d'>' -f2,2 | cut -d' ' -f2,2`" = \
        	"$DAEMON" ]; then
            # ok, process seems to be running
            exit 0
        elif [ -r $PIDFILE ]; then
            # process not running, but pidfile exists
            exit 1
        else
            # no lock file to check for, so simply return the stopped status
            exit 3
        fi
        ;;
  *)
    echo "Usage: /etc/init.d/pptpd {start|stop|restart|force-reload}"
    exit 1
    ;;
esac

exit 0