#!/bin/sh
#
# Cron.daily script for slrnpull.
# Written By Joey Hess <joeyh@debian.org>

[ -x /usr/bin/slrnpull ] || exit 0

if [ -f /etc/default/slrnpull ]; then
	. /etc/default/slrnpull
fi

cd /var/spool/slrnpull

# Perform expiration, even if we aren't fetching articles right now.
su news -c 'slrnpull --expire >/dev/null'

if  [ "$RUNFROM" = "cron job" ] ; then
	# Get new articles.
	su news -s /bin/sh -c 'slrnpull -h `head -n 1 /etc/news/server`' >/dev/null
fi
