summaryrefslogtreecommitdiff
path: root/contrib/debian/accel-pptp-init
blob: fd483323105440802800287189ee6c890c92c525 (plain)
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
54
55
56
57
58
59
#!/bin/sh
# /etc/init.d/accel-pptpd: set up the accel-pptp server
### BEGIN INIT INFO
# Provides:          accel-pptp
# Required-Start:    $networking
# Required-Stop:     $networking
# Default-Start:     2 3 4 5
# Default-Stop:      1
### END INIT INFO

set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin

. /lib/lsb/init-functions

if test -f /etc/default/accel-pptp; then
    . /etc/default/accel-pptp
fi

if [ -z $ACCEL_PPPTD_OPTS ]; then
  ACCEL_PPTPD_OPTS="-c /etc/accel-pptp.conf"
fi

case "$1" in
  start)
	log_daemon_msg "Starting accel-pptp server" "accel-pptpd"
	if start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/accel-pptpd -- -d -p /var/run/accel-pptpd.pid $ACCEL_PPTPD_OPTS; then
	    log_end_msg 0
	else
	    log_end_msg 1
	fi
  ;;
  restart)
	log_daemon_msg "Restarting accel-pptp server" "accel-pptpd"
	start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pptpd.pid
	if start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/accel-pptpd -- -d -p /var/run/accel-pptpd.pid $ACCEL_PPTPD_OPTS; then
	    log_end_msg 0
	else
	    log_end_msg 1
	fi
  ;;

  stop)
	log_daemon_msg "Stopping accel-pptp server" "accel-pptpd"
	start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pptpd.pid
	log_end_msg 0
  ;;

  status)
    do_status
  ;;
  *)
    log_success_msg "Usage: /etc/init.d/accel-pptp {start|stop|status|restart}"
    exit 1
    ;;
esac

exit 0