diff options
author | Joerg Jaspert <joerg@debian.org> | 2008-09-27 16:03:10 +0200 |
---|---|---|
committer | Joerg Jaspert <joerg@debian.org> | 2008-09-27 16:03:10 +0200 |
commit | f8b18dafeb8fc656483f0afadf7b67138d7e9c3b (patch) | |
tree | b302de5134f74c642161b71daeec80396e953c61 /etc | |
parent | f861c6d92ef6b9cf4ddaaf5f8205b98be64899be (diff) |
ftpsync
Add a (rewritten) ftpsync script together with an config file example.
Signed-off-by: Joerg Jaspert <joerg@debian.org>
Diffstat (limited to 'etc')
-rw-r--r-- | etc/common | 21 | ||||
-rw-r--r-- | etc/ftpsync.conf | 7 |
2 files changed, 28 insertions, 0 deletions
@@ -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" |