From f8b18dafeb8fc656483f0afadf7b67138d7e9c3b Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Sat, 27 Sep 2008 16:03:10 +0200 Subject: ftpsync Add a (rewritten) ftpsync script together with an config file example. Signed-off-by: Joerg Jaspert --- etc/common | 21 +++++++++++++++++++++ etc/ftpsync.conf | 7 +++++++ 2 files changed, 28 insertions(+) create mode 100644 etc/ftpsync.conf (limited to 'etc') diff --git a/etc/common b/etc/common index ee2bd92..699481b 100644 --- a/etc/common +++ b/etc/common @@ -29,3 +29,24 @@ signal () { # Finally call ssh ssh $SSH_OPTIONS -i "$5" -o"user $3" -$4 "$2" sleep 1 >> ${LOG}/$1.log 2>&1 & } + + +# log something (basically echo it together with a timestamp) +# +# Set $PROGRAM to a string to have it added to the output. +log () { + if [ -z ${PROGRAM} ]; then + echo "$(date +"%b %d %H:%M:%S") $(hostname -s) [$$] $@" + else + echo "$(date +"%b %d %H:%M:%S") $(hostname -s) ${PROGRAM}[$$]: $@" + fi +} + +# log the message using log() but then also send a mail +# to the address configured in MAILTO (if non-empty) +error () { + log "$@" + if [ -z ${MAILTO} ]; then + echo "$@" | mail -e -s "$PROGRAM ERROR ($(hostname -s)) [$$]" ${MAILTO} + fi +} diff --git a/etc/ftpsync.conf b/etc/ftpsync.conf new file mode 100644 index 0000000..510ed4d --- /dev/null +++ b/etc/ftpsync.conf @@ -0,0 +1,7 @@ +TO=/org/ftp.debian.org/ftp/ +RSYNC_HOST=some.mirror.debian.org +RSYNC_USER=USER +RSYNC_PASSWORD=PASSWORD +RSYNC_PATH="debian-all" +PROGRAM=ftpsync +MAILTO="somewhere@example.com" -- cgit v1.2.3