#! /bin/sh
# start/stop logoutd

set -e

test -f /usr/sbin/logoutd || exit 0

# Most people won't need logoutd(8) running, so we'll only run it if
# /etc/porttime has non-comment lines.
egrep -vq '^#|^ *$' /etc/porttime || exit 0

case "$1" in
    start)
	echo -n "Starting login time and port restriction enforcer: logoutd"
	start-stop-daemon --start --quiet --exec /usr/sbin/logoutd
	echo "."
	;;
    stop)
	echo -n "Stopping login time and port restriction enforcer: logoutd"
	start-stop-daemon --stop --quiet --exec /usr/sbin/logoutd
	echo "."
	;;
    *)
	echo "Usage: /etc/init.d/logoutd start|stop"
	exit 1
	;;
esac

exit 0
