Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # xl2tpd This shell script takes care of starting and stopping l2tpd.
- #
- # description: Layer 2 Tunnelling Protocol Daemon (RFC 2661)
- #
- # processname: xl2tpd
- CONFIG_FILE=/etc/xl2tpd/xl2tpd.conf
- SECRETS_FILE=/etc/ppp/chap-secrets
- DAEMON=xl2tpd
- [ -x /usr/sbin/$DAEMON ] || exit 0
- RETVAL=0
- start() {
- echo "Starting $DAEMON..."
- if [ ! -d /var/run/xl2tpd ];then
- mkdir /var/run/xl2tpd
- fi
- /usr/sbin/$DAEMON -c $CONFIG_FILE -s $SECRETS_FILE &
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$DAEMON
- return $RETVAL
- }
- stop() {
- echo "Stopping $DAEMON..."
- kill -9 `cat /var/run/xl2tpd.pid`
- RETVAL=$?
- [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$DAEMON
- return $RETVAL
- }
- restart() {
- stop
- start
- }
- status() {
- PID="`ps ax | awk '{if (match($5, ".*/xl2tpd$") || $5 == "xl2tpd") print $1}'`"
- if test "$PID" != ""; then
- echo "xl2tpd is running."
- else
- echo "xl2tpd is not running."
- fi
- }
- # See how we were called.
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status
- ;;
- restart|reload)
- restart
- ;;
- condrestart)
- [ -f /var/lock/subsys/$DAEMON ] && restart || :
- ;;
- *)
- echo "Usage: $DAEMON {start|stop|status|restart|reload|condrestart}"
- exit 1
- esac
Advertisement
Add Comment
Please, Sign In to add comment