#! /bin/sh # # chkconfig: - 11 89 # description: Starts and stops PPTP connection. # processname: pptptunnel # config: /etc/sysconfig/network # config: /etc/sysconfig/pptp WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions SourceIfNotEmpty /etc/sysconfig/network SourceIfNotEmpty /etc/sysconfig/pptp PIDFILE=/var/run/ppp-$PPTP_TUNNEL.pid LOCKFILE=/var/lock/subsys/pptptunnel RETVAL=0 SERVICE_NAME="\"$PPTP_TUNNEL\" PPTP tunnel" start() { msg_starting "$SERVICE_NAME" if [ "x$PPTP_TUNNEL" = "x" ]; then echo -n "tunnel not defined!" failure "tunnel not defined!" exit 1 fi start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root --no-announce -- \ pppd call $PPTP_TUNNEL linkname $PPTP_TUNNEL updetach RETVAL=$? return $RETVAL } stop() { msg_stopping "$SERVICE_NAME" stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root --no-announce pppd RETVAL=$? return $RETVAL } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; condreload) if [ -e "$LOCKFILE" ]; then restart fi ;; status) msg_already_running "$SERVICE_NAME" echo status --pidfile "$PIDFILE" --expect-user root --no-anounce pppd RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|restart|reload|condstop|condrestart|condreload|status}" RETVAL=1 esac exit $RETVAL