#!/bin/sh
#
# This script starts 'postit' in a way that feedfiles are properly
# flushed and re-created.

postit_configfile=/etc/news/postit.conf

if [ -f $postit_configfile ]
then
	source $postit_configfile
else
	echo "kein configfile gefunden\n"
	# Enter your paths here if you are not able to change the configfile
	SPOOLPATH=/var/spool/news
	OUTGOING=${SPOOLPATH}/out.going
	BINPATH=/usr/lib/news/bin
	NEWSSERVER=news.foo.org
fi


# Below is an example for a feedfile called ${NEWSSERVER},
# which is to be fed to ${NEWSSERVER}.
# We flush the feed, then rename it, restart the
# feed process, and finally process the renamed feedfile.

${BINPATH}/ctlinnd flush ${NEWSSERVER}
mv ${OUTGOING}/${NEWSSERVER} ${OUTGOING}/${NEWSSERVER}.postit
${BINPATH}/ctlinnd begin ${NEWSSERVER}
${BINPATH}/postit ${NEWSSERVER}.postit ${NEWSSERVER}
