view debian/init @ 449:a299b029c283 noffle

[svn] fixed transition pathname
author godisch
date Wed, 25 Jun 2003 17:25:50 +0100
parents fc3e4fc0a88d
children fb4e5f59f4a7
line wrap: on
line source

#!/bin/sh
# $Id: init 585 2003-06-25 15:34:53Z godisch $

set -e

PATH="/bin:/usr/bin:/sbin:/usr/sbin"
NOFFLE="/usr/bin/noffle"

help () {
	echo "Usage: /etc/init.d/noffle { online | offline }" >&2
}

if [ ! -x "$NOFFLE" ]; then
	echo "Cannot execute noffle: program not found." >&2
	exit 5 # LSB: program is not installed
fi

if [ "$2" ]; then
	help
	exit 2 # LSB: invalid or excess argument(s)
fi

if [ -x /usr/sbin/pppd ]; then
	NOFFLE_FETCHMODE="ppp"
else
	NOFFLE_FETCHMODE="cron"
fi
if [ -f /etc/default/noffle ]; then
	. /etc/default/noffle
fi

case "$1" in
start)
	echo -n "Initializing offline news server: "
	if [ "$NOFFLE_FETCHMODE" = ppp ]; then
		"$NOFFLE" --offline
	else
		"$NOFFLE" --online
	fi
	echo "."
	;;
stop)
	echo -n "Switching offline news server into offline mode: "
	"$NOFFLE" --offline
	echo "."
	;;
restart)
	echo "No action done, as noffle is restarted upon each query."
	;;
reload|force-reload)
	echo "No action done, as noffle reloads its configuration upon each query."
	;;
status)
	help
	exit 4 # LSB: program or service status is unknown
	;;
online|offline)
	echo -n "Switching offline news server into $1 mode: "
	"$NOFFLE" --$1
	echo "."
	;;
*)
	help
	exit 2 # LSB: invalid or excess argument(s)
	;;
esac

exit 0