Added check for dirs to backup
This commit is contained in:
parent
2ef2e1b0d2
commit
4e293a4582
16
autotape.sh
16
autotape.sh
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
### Config options ###
|
### Config options ###
|
||||||
BACKUP_DIRS="/home/jake/Documents/wallpapers"
|
BACKUP_DIRS="/mnt/raid1/backups/weekly"
|
||||||
DRIVE="/dev/st0"
|
DRIVE="/dev/st0"
|
||||||
RECHECK_WAIT=1200
|
RECHECK_WAIT=1200
|
||||||
MT="/bin/mt"
|
MT="/bin/mt"
|
||||||
@ -62,6 +62,16 @@ if [ ! -x ${TAR} ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Check_backupdir()
|
||||||
|
{
|
||||||
|
for dirtest in ${BACKUP_DIRS}; do
|
||||||
|
if [ ! -d $dirtest ]; then
|
||||||
|
echo "${dirtest} does not exist" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
### Main routine ###
|
### Main routine ###
|
||||||
@ -69,6 +79,9 @@ fi
|
|||||||
# Check if the utils/programs exists
|
# Check if the utils/programs exists
|
||||||
Check_utils
|
Check_utils
|
||||||
|
|
||||||
|
# Check if the dirs we want to backup exists
|
||||||
|
Check_backupdir
|
||||||
|
|
||||||
# Check and repeat until the tape drive is on/connected
|
# Check and repeat until the tape drive is on/connected
|
||||||
EXIT_STATE=3
|
EXIT_STATE=3
|
||||||
while [ ${EXIT_STATE} != 0 ]; do
|
while [ ${EXIT_STATE} != 0 ]; do
|
||||||
@ -87,5 +100,6 @@ while [ ${EXIT_STATE} != 0 ]; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Finally, begin with the backup!
|
||||||
Do_backup
|
Do_backup
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user