#!/bin/sh
# Sample script for execution as part of a cron job
# Triggers precaching of remote contents, see manual for details

# optional, specify hostname to appear in error messages and links
# HOSTNAME=externallyVisibleHostName
# export HOSTNAME

# optional, specify IP address to connect to
# ACNGIP=10.0.1.3
# export ACNGIP

ACNGREQ='?doDownload=dd&asNeeded=an&useDebDelta=ud&doMirror=Start+Mirroring'
export ACNGREQ

if perl -e 'use MIME::Base64' 2>/dev/null \
   && test -r /usr/lib/apt-cacher-ng/expire-caller.pl ;
then
   perl /usr/lib/apt-cacher-ng/expire-caller.pl || echo Please check error messages in one of: $(ls -t /var/log/apt-cacher-ng/maint*.log.html | head -n5)
else
   echo $(date -R)\|/etc/cron.daily/apt-cacher-ng\| Error starting expiration helper. Install the perl package, check apt-cacher-ng installation. >> /var/log/apt-cacher-ng/apt-cacher.err
fi
