error handling improvment in archlinux.sh

This commit is contained in:
root@saturn committed 2016-02-02 13:33:46 +01:00
1 parent 293af4bfb2
commit 18d991b19b
1 file changed
+7 -1
+7 -1
View File
@@ -1,4 +1,10 @@
#/bin/bash
fatal() {
echo "$1"
exit 1
}
#RSYNCSOURCE=rsync://ftp5.gwdg.de/pub/linux/archlinux/
#RSYNCSOURCE=rsync://mirror.nl.leaseweb.net/archlinux/
RSYNCSOURCE=rsync://mirror.one.com/archlinux/
@@ -9,7 +15,7 @@ BASEDIR=/store/mirror/archlinux
rsync --verbose --recursive --times --links --hard-links \
--stats --delete-after --ignore-errors \
${RSYNCSOURCE} ${BASEDIR} &>> /opt/scripts/archlinux.log || echo "Failed to rsync from ${RSYNCSOURCE}."
${RSYNCSOURCE} ${BASEDIR} &>> /opt/scripts/archlinux.log || fatal "Failed to rsync from ${RSYNCSOURCE}."
date &>> /opt/scripts/archlinux.log
echo "############################" &>> /opt/scripts/archlinux.log