#! /bin/sh
#
# skeleton example file to build /etc/init.d/ scripts.
# This file should be used to construct scripts for /etc/init.d.
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl
#
# This file was automatically customized by dh-make on Thu, 1 Apr 2004 20:05:44 +0200
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/chilli
NAME=chilli
DESC=chilli
CONFFILE=/etc/chilli.conf
OPTS="--pidfile /var/run/$NAME.pid"
START_CHILLI=0
if [ -f /etc/default/chilli ] ; then
. /etc/default/chilli
fi
if [ "$START_CHILLI" != "1" ] ; then
echo "Chilli default off. Look at /etc/default/chilli"
exit 0
fi
test -f $DAEMON || exit 0
test -f $CONFFILE || exit 0
. /etc/chilli/functions
check_required
RETVAL=0
prog="chilli"
case "$1" in
start)
echo -n "Starting $DESC: "
/sbin/modprobe tun >/dev/null 2>&1
echo 1 > /proc/sys/net/ipv4/ip_forward
writeconfig
radiusconfig
(crontab -l 2>&- | grep -v $0
test ${HS_ADMINTERVAL:-0} -gt 0 && echo "*/$HS_ADMINTERVAL * * * * $0 radconfig"
echo "*/10 * * * * $0 checkrunning"
#echo "*/2 * * * * $0 arping"
) | crontab - 2>&-
ifconfig $HS_LANIF 0.0.0.0
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON -- $OPTS
RETVAL=$?
echo "$NAME."
;;
checkrunning)
check=`start-stop-daemon --start --exec $DAEMON --test`
if [ x"$check" != x"$DAEMON already running." ] ; then
$0 start
fi
;;
radconfig)
[ -e $MAIN_CONF ] || writeconfig
radiusconfig
;;
restart)
$0 stop
$0 start
RETVAL=$?
;;
stop)
echo -n "Stopping $DESC: "
crontab -l 2>&- | grep -v $0 | crontab -
start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON
echo "$NAME."
;;
reload)
echo "Reloading $DESC."
start-stop-daemon --stop --signal 1 --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON
;;
condrestart)
check=`start-stop-daemon --start --exec $DAEMON --test`
if [ x"$check" != x"$DAEMON already running." ] ; then
$0 restart
RETVAL=$?
fi
;;
status)
status chilli
RETVAL=$?
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|condrestart|status|reload|radconfig}" >&2
exit 1
;;
esac
exit 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>