Skip to content
Snippets Groups Projects
Commit 41c0b628 authored by Bob Mottram's avatar Bob Mottram
Browse files

Optionally remove existing usb backup before starting new one

parent 3c6aab92
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -189,6 +189,17 @@ function make_backup_directory {
fi
}
function remove_backup_directory {
if [ $1 ]; then
if [[ $1 == "remove" ]]; then
if [ ! -d $USB_MOUNT/backup ]; then
rm -rf $USB_MOUNT/backup
echo 'Existing backup directory removed'
fi
fi
fi
}
function check_storage_space_remaining {
# Check space remaining on the usb drive
used_percent=$(df -k $USB_MOUNT | tail -n 1 | awk -F ' ' '{print $5}' | awk -F '%' '{print $1}')
......@@ -324,6 +335,7 @@ function backup_directories {
}
mount_drive $1 $2
remove_backup_directory $2
make_backup_directory
check_storage_space_remaining
backup_users
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment