summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJoerg Jaspert <joerg@debian.org>2008-10-04 18:10:41 +0200
committerJoerg Jaspert <joerg@debian.org>2008-10-04 18:10:41 +0200
commit1b12f517bca0297adbd51c9498f15ba50483547f (patch)
tree16b9baa43e3a9ef9b4c84bd63dde94b233003d6b /bin
parent57e0cb0e82ae32883e4900845a3de01815b303dc (diff)
ftpsync
and another option to only mail errors instead of always full logs Signed-off-by: Joerg Jaspert <joerg@debian.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ftpsync12
1 files changed, 8 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};
}