summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/ftpsync12
-rw-r--r--etc/ftpsync.conf1
2 files changed, 9 insertions, 4 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index e44e63f..b074dd2 100755
--- a/bin/ftpsync
+++ b/bin/ftpsync
@@ -72,6 +72,8 @@ PROGRAM=${PROGRAM:-"${NAME}-$(hostname -s)"}
# Where to send mails about mirroring to?
MAILTO=${MAILTO:-"mirrorlogs@debian.org"}
+# Want errors only or every log?
+ERRORSONLY=${ERRORSONLY:-"false"}
# How to rotate our log
SAVELOG=${SAVELOG:-"savelog -t -c 14"}
@@ -147,20 +149,22 @@ touch "${UPDATEREQUIRED}"
cleanup() {
trap - ERR TERM HUP INT QUIT EXIT
# all done. Mail the log, exit.
+ log "Mirrorsync done";
if [ -n "${MAILTO}" ]; then
# In case rsync had something on stderr
if [ -s "${LOGDIR}/rsync-${NAME}.error"]; then
cat "${LOGDIR}/rsync-${NAME}.error" | mail -e -s "$PROGRAM rsync ERROR ($(hostname -s)) [$$]" ${MAILTO}
fi
- # And the normal log
- mail -e -s "${PROGRAM} ($(hostname)) - archive sync finished on $(date +"%Y.%m.%d-%H:%M:%S")" ${MAILTO} < ${LOG}
+ if [ "x${ERRORSONLY}x" = "xfalsex" ]; then
+ # And the normal log
+ mail -e -s "${PROGRAM} ($(hostname)) - archive sync finished on $(date +"%Y.%m.%d-%H:%M:%S")" ${MAILTO} < ${LOG}
+ fi
fi
${SAVELOG} ${LOGDIR}/rsync-${NAME}.log
${SAVELOG} ${LOGDIR}/rsync-${NAME}.error
-
- log "Mirrorsync done";
${SAVELOG} "$LOG" > /dev/null
+
rm -f ${LOCK};
}
diff --git a/etc/ftpsync.conf b/etc/ftpsync.conf
index 709a42d..21e9aa4 100644
--- a/etc/ftpsync.conf
+++ b/etc/ftpsync.conf
@@ -5,6 +5,7 @@ RSYNC_PASSWORD=PASSWORD
RSYNC_PATH="debian-all"
PROGRAM=ftpsync
MAILTO="somewhere@example.com"
+ERRORSONLY="false"
# Hook scripts can be run at various places during the sync.
# Leave them blank if you don't want any
# Hook1: After lock is acquired, before first rsync