#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2010 OpenWrt.org

START=60
DEFAULTDISABLE=true
EXECMD=/usr/sbin/xl2tpd
BIN=xl2tpd
DEFAULT=/etc/default/$BIN
RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
EXTRA_COMMANDS=" status "
SERVICE_USE_PID=1
SERVICE_WRITE_PID=1
SERVICE_QUIET="1"
SERVICE_MATCH_EXEC=""

start() {
	mkdir -p $RUN_D/$BIN
	[ -f $DEFAULT ] && . $DEFAULT
	$EXECMD $OPTIONS
}

stop() {
	[ -f $PID_F ] && kill $(cat $PID_F)
}

status(){
	service_check ${EXECMD}
	err=$?
	if [ $err -eq 0 ]; then
		echo "xl2tpd is running"
		return 0       # is running
	else
		echo "xl2tpd is error[${err}]"
		return $err      # error
	fi
}
