#!/bin/sh
#
# l2tpd			This shell script takes care of starting and stopping l2tpd.
#
# chkconfig:    2345 80 30
# description: User-space implementation of L2TP (RFC 2661) for Linux
#
# processname:  l2tpd
# config:       /etc/l2tpd/l2tpd.conf
# pidfile:      /var/run/l2tpd.pid
 

#Servicename
SERVICE=l2tpd

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

if [ ${NETWORKING} = "no" ]
then
	exit 0
fi

[ -x /usr/sbin/$SERVICE ] || exit 0

# See how we were called.
case "$1" in
  start)
	  gprintf "Starting $SERVICE: "
	  daemon $SERVICE
	  RETVAL=$?
	  echo
	  [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
	  ;;
  stop)
	gprintf "Stopping $SERVICE: "
	killproc $SERVICE
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE
	;;
  status)
	status $SERVICE
	RETVAL=$?
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
	gprintf "Usage: $SERVICE {start|stop|status|restart|reload}\n"
	exit 1
esac
