From c8a946c6a3edc8dccc97945579ab9f1bde1bdf50 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Tue, 14 Mar 2017 13:01:41 +0100 Subject: alt error handling --- scripts/pull-and-verify.sh | 25 ++++++++++++++++--------- scripts/update-cron.sh | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/scripts/pull-and-verify.sh b/scripts/pull-and-verify.sh index 1e467010..0cfb22c3 100755 --- a/scripts/pull-and-verify.sh +++ b/scripts/pull-and-verify.sh @@ -1,9 +1,4 @@ -#!/bin/bash - -function die() { - echo $* - exit 1 -} +#!/bin/bash -x URL=$1 DIR=$2 @@ -16,12 +11,24 @@ else fi TMPF=`mktemp` -curl -s -m 120 -k -L $URL > $TMPF || die "Unable to download $URL: $?" +curl -s -m 120 -k -L $URL > $TMPF +if [ $? -ne 0 ]; then + echo "Unable to download $URL: $?" + exit 1 +fi if [ "x$CERT" != "x" ]; then - samlsign -c $CERT -f $TMPF || die "Unable to verify $URL with $CERT: $?" + samlsign -c $CERT -f $TMPF + if [ $? -ne 0 ]; then + echo "Unable to verify $URL with $CERT: $?" + exit 1 + fi fi TMPD=`mktemp -d` -xsltproc --stringparam output $TMPD xslt/import-metadata.xsl $TMPF || die "Unable to import metadata from $URL: $?" +xsltproc --stringparam output $TMPD xslt/import-metadata.xsl $TMPF +if [ $? -ne 0 ]; then + echo "Unable to import metadata from $URL: $?" + exit 1 +fi rsync -avz $TMPD/ $DIR ( echo '' diff --git a/scripts/update-cron.sh b/scripts/update-cron.sh index 8c076a93..6f5925ef 100755 --- a/scripts/update-cron.sh +++ b/scripts/update-cron.sh @@ -7,7 +7,7 @@ update() echo echo "make aggregate" - #make aggregate || return $? + make aggregate || return $? echo echo "make (2007)" -- cgit v1.2.3