3 # Setup and Create temporary path
9 tmp=$(mktemp -td postlicyd-rsyncrbl.XXXXXX) || exit 1
10 successfile="$tmp/.success"
13 # Cleanup and force reload of the postlicyd daemon
15 if [ -f "$successfile" ] && [ -f "$pidfile" ] ; then
17 [ -z "$pid" ] || kill -HUP $(cat "$pidfile")
31 echo "usage: $(basename "$0") confile spoolroot pidfile"
32 [ -z "$1" ] || echo "$1"
49 mtime_before=$(file_stats "$out")
50 rsync --no-motd -q -t -T "$tmp" "$url" "$out" || return 1
51 mtime_after=$(file_stats "$out")
53 # The file has changed
54 if [ "$mtime_after" != "$mtime_before" ] ; then
55 # Update ownership and permissions
56 chown nobody:nogroup "$out"
59 # Touch the successful file that is used to check if a reload
66 # Check command line arguments
71 [ -z "$pidfile" ] && usage
72 [ -f "$conf" ] || usage "configuration file ($conf) does not exists"
73 [ -d "$spool" ] || usage "spool directory ($spool) does not exists"
77 cd "$spool" || die "Can't cd to $spool"
79 for line in $(grep -v "^#" "$conf" | grep '=') ; do
82 getfile $url $out || echo "error downloading file $out from $url"