Improving error handling if we have problems with dirs.
authorChris Sharp <csharp@georgialibraries.org>
Mon, 13 Jan 2014 18:42:21 +0000 (13:42 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 13 Jan 2014 18:42:21 +0000 (13:42 -0500)
grab-utility01-configs.sh

index ca52c0d..69815ba 100755 (executable)
@@ -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