#!/bin/sh
# This cron script will check for existance of dnswl files
# before starting the update. This means that the first time
# /usr/bin/dnswl.sh should be ran manually.

if [ -f /etc/postfix/postfix-dnswl-header -a -e /etc/postfix/postfix-dnswl-permit ]; then
	sleep $(( $RANDOM % 7200 ))
	> /var/log/dnswl.log
	_slept=1
	/usr/bin/dnswl.sh postfix > /var/log/dnswl.log 2>&1
fi

if [ -f /var/lib/rbldnsd/dnswl/rbldnsd-dnswl ]; then
	if [ -z "$_slept" ]; then
		sleep $(( $RANDOM % 7200 ))
		> /var/log/dnswl.log
	fi
	/usr/bin/dnswl.sh rbldnsd > /var/log/dnswl.log 2>&1
fi
