+# Check if there is a newer version of ftpsync. If so inform the admin, but not
+# more than once every third day.
+if [ -r "${TO}/project/ftpsync/LATEST.VERSION" ]; then
+ LATEST=$(< "${TO}/project/ftpsync/LATEST.VERSION")
+ if ! [[ ${LATEST} =~ [0-9]+ ]]; then
+ LATEST=0
+ fi
+ if [ ${LATEST} -gt ${VERSION} ]; then
+ if [ -n "${MAILTO}" ]; then
+ difference=0
+ if [ -f "${LOGDIR}/ftpsync.newversion" ]; then
+ stamptime=$(< "${LOGDIR}/ftpsync.newversion")
+ unixtime=$(date +%s)
+ difference=$(( $unixtime - $stamptime ))
+ fi
+ if [ ${difference} -ge 259200 ]; then
+ # Only warn every third day
+ mail -e -s "[$(hostname -s)] Update for ftpsync available" ${MAILTO} <<EOF
+Hello admin,
+
+i found that there is a new version of me available.
+Me lonely ftpsync is currently version: ${VERSION}
+New release of myself is available as: ${LATEST}
+
+Me, myself and I - and the Debian mirroradmins - would be very grateful
+if you could update me. You can find the latest version on your mirror,
+check $(hostname -s):${TO}/project/ftpsync/ftpsync-${LATEST}.tar.gz
+
+You can ensure the validity of that file by using sha512sum or md5sum
+against the available checksum files secured with a signature from the
+Debian FTPMaster signing key.
+
+EOF
+
+ date +%s > "${LOGDIR}/ftpsync.newversion"
+ fi
+ fi
+ else
+ # Remove a possible stampfile
+ rm -f "${LOGDIR}/ftpsync.newversion"
+ fi
+fi
+