view debian/init @ 494:372f8b55506e noffle

[svn] Apply patch from Jan De Luyck. Add new option 'add-messageid-if-missing', which optionally postpones adding a message ID to the upstream server. If this is done, post-locally must be off. This is to deal with an upstream server troubling Jan. It usually (but not always) rejects posts with a Noffle message ID. I have changed Jan's original option of 'add-message-id-if-missing' for consistency with 'replace-messageid' and added the manual page entry. See SourceForge feature request 1513395.
author bears
date Wed, 12 Jul 2006 20:26:41 +0100
parents 0c7220ddf348
children
line wrap: on
line source

#!/bin/sh
# $Id: init 615 2003-08-31 15:16:28Z 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
	exit 0 # Debian policy: exit quietly, see #206928
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 "Initializing offline news server..."
	if [ "$NOFFLE_FETCHMODE" = ppp ]; then
		"$NOFFLE" --offline
	else
		"$NOFFLE" --online
	fi
	echo "Done."
	;;
stop)
	echo "Switching offline news server into offline mode..."
	"$NOFFLE" --offline
	echo "Done."
	;;
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 "Switching offline news server into $1 mode..."
	"$NOFFLE" --$1
	echo "Done."
	;;
*)
	help
	exit 2 # LSB: invalid or excess argument(s)
esac

exit 0