From 7a5788d2dd13c4c6235ecda12a22a29818f50eaf Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Mon, 13 Jan 2014 13:42:21 -0500 Subject: [PATCH] Improving error handling if we have problems with dirs. --- grab-utility01-configs.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/grab-utility01-configs.sh b/grab-utility01-configs.sh index ca52c0d..69815ba 100755 --- a/grab-utility01-configs.sh +++ b/grab-utility01-configs.sh @@ -30,8 +30,10 @@ if [ ! -d $ARCHIVE_DIR ]; then mkdir $ARCHIVE_DIR fi -cd $ARCHIVE_DIR || echo "Could not cd to $ARCHIVE_DIR." - +cd $ARCHIVE_DIR || { + echo "Could not cd to $ARCHIVE_DIR." + exit; +} echo "Copying configuration directory $CONF_DIR..." cp -r $CONF_DIR . @@ -42,7 +44,10 @@ cp -r $OVERDUE_DIR . echo "Copying offline data directory $OFFLINE_DIR..." cp -r $OFFLINE_DIR . -cd $WORKING_DIR || echo "Could not cd to $WORKING_DIR" +cd $WORKING_DIR || { + echo "Could not cd to $WORKING_DIR" + exit; +} echo "Compressing directory..." tar czvf $ARCHIVE_DIR.tar.gz $ARCHIVE_DIR -- 2.11.0