From 943afcf723c55264e7a68ac8291ef52bbd51dd85 Mon Sep 17 00:00:00 2001 From: Jack-Benny Persson Date: Sun, 22 Dec 2013 09:07:58 +0100 Subject: [PATCH] Added a sanity check () and changed test -b to test -e for tape device --- Labb5/serverbackup/serverbackup.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Labb5/serverbackup/serverbackup.sh b/Labb5/serverbackup/serverbackup.sh index befb87f..f83ea85 100755 --- a/Labb5/serverbackup/serverbackup.sh +++ b/Labb5/serverbackup/serverbackup.sh @@ -47,9 +47,15 @@ for i in $Ls $Tar $Sort $Tail $Uniq $Mount $Umount $Mt $Cp $Mkdir; do fi done +# Check that BackupDir exists +if [ ! -d $BackupDir ]; then + echo "$BackupDir dosen't seem to exist, aborting" > /dev/stderr + exit 2 +fi + # Check that our tape drive is on and connected and a tape is inserted if [ "$Where" = "Tape" ] || [ "$Where" = "Tape&HDD" ]; then - if [ ! -b $TapeDev ]; then + if [ ! -e $TapeDev ]; then echo "$CurTime No tape device present at $TapeDev" > /dev/stderr exit 2 fi