1#!/bin/sh
2#
3# Startup script for pptpd
4#
5# chkconfig: - 85 15
6# description: PPTP server
7# processname: pptpd
8# config: /etc/pptpd.conf
9
10
11# Source function library.
12. /etc/rc.d/init.d/functions
13# See how we were called.
14case "$1" in
15  start)
16        echo -n "Starting pptpd: "
17        if [ -f /var/lock/subsys/pptpd ] ; then
18                echo
19                exit 1
20        fi
21        daemon /usr/sbin/pptpd
22        echo
23        touch /var/lock/subsys/pptpd
24        ;;
25  stop)
26        echo -n "Shutting down pptpd: "
27        killproc pptpd
28        echo
29        rm -f /var/lock/subsys/pptpd
30        ;;
31  status)
32        status pptpd
33        ;;
34  condrestart)
35	if [ -f /var/lock/subsys/pptpd ]; then
36		$0 stop
37		$0 start
38	fi
39	;;
40  reload|restart)
41        $0 stop
42        $0 start
43        echo "Warning: a pptpd restart does not terminate existing "
44        echo "connections, so new connections may be assigned the same IP "
45        echo "address and cause unexpected results.  Use restart-kill to "
46        echo "destroy existing connections during a restart."
47        ;;
48  restart-kill)
49        $0 stop
50        ps -ef | grep pptpd | grep -v grep | grep -v rc.d | awk '{print $2}' | uniq | xargs kill 1> /dev/null 2>&1
51        $0 start
52        ;;
53  *)
54        echo "Usage: $0 {start|stop|restart|restart-kill|status}"
55        exit 1
56esac
57
58exit 0
59