SourceForge.net Logo

B.26. /etc/init.d/l2tpd

#!/bin/ash
# 
# GPL $Id: l2tpd,v 1.3 2005/10/09 16:39:04 cvonk Exp $
# system init for L2TP daemon (l2tpd)

case "$1" in
    start)
	. /etc/init.d/functions
	getaddr eth1 IP_ETH1
	sed "/^listen-addr.*=/s,=.*,= $IP_ETH1,g;" \
	    < /etc/sysconfig/l2tpd.conf > /tmp/l2tpd.conf
	# to debug: add -D and watch stdout and stderr
        l2tpd -c /tmp/l2tpd.conf 2> /dev/null
        ;;
    stop)
        killall l2tpd 2>/dev/null
        ;;
    restart)
	$0 stop
	$0 start
	;;
    status)
        if pidof l2tpd | sed "s/$$\$//" | grep -q [0-9] ; then
	    echo "running"
        else
	    echo "stopped"
        fi
        ;;
esac
# 

Example B.26. /etc/init.d/l2tpd