#!/bin/sh # # Author: Arno, 2011 # # /etc/init.d/pptpd # and its symbolic link # /opt/pptpd.sh # # pptpd This shell script takes care of starting and stopping # pptpd service (pptp vpn service) # # changes 20110729, created the script. ### BEGIN INIT INFO # Provides: pptpd # Required-Start: $network # Required-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: pptpd daemon, providing a useful network service # Description: The pptpd daemon is a vpn network service. # We want it to be active in runlevels 3 and 5, # as these are the runlevels with the network available. ### END INIT INFO # Source function library. if [ -f /etc/init.d/functions ] ; then . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ] ; then . /etc/rc.d/init.d/functions else exit 1 fi # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 RETVAL=0 DAEMON_PATH="/usr/local/sbin" DAEMON_BIN="pptpd" DAEMON_CONF="/etc/pptpd.conf" DAEMON_PID="/var/run/pptpd.pid" DAEMON_OPTIONS="-c $DAEMON_CONF --debug --pidfile $PIDFILE" start() { # Start daemons. echo -n $"Starting $DAEMON_BIN: " daemon $DAEMON_PATH/$DAEMON_BIN RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pptpd return $RETVAL } stop() { # Stop daemons. echo -n $"Shutting down $DAEMON_BIN: " killproc pptpd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pptpd return $RETVAL } daemon_status() { status pptpd return $? } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/firewall ]; then stop start RETVAL=$? fi ;; status) daemon_status ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL