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

If backup drive is getting too full then remove backup directory before creating new backup

parent 5aecfae5
No related branches found
No related tags found
No related merge requests found
......@@ -90,11 +90,16 @@ function make_backup_directory {
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}')
if [ "$used_percent" -gt 95 ]; then
echo $"Less than 5% of space remaining on backup drive"
umount $USB_MOUNT
rm -rf $USB_MOUNT
exit 4
if [ "$used_percent" -gt 80 ]; then
echo $"Less than 20% of space remaining on backup drive"
if [ -d $USB_MOUNT/backup ]; then
echo $"Deleting existing backup directory"
rm -rf $USB_MOUNT/backup
else
umount $USB_MOUNT
rm -rf $USB_MOUNT
exit 4
fi
fi
}
......
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