Check disk usage before backup to usb
This commit is contained in:
parent
cd2715de04
commit
53740e6ebf
|
@ -2585,6 +2585,23 @@ function create_backup_script {
|
||||||
echo ' rm -rf $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
echo ' rm -rf $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
echo ' exit 27' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
echo ' exit 27' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
|
||||||
|
echo -n 'used_percent=$(df -k $USB_MOUNT | ' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo -n "awk -F ' ' '{print " >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo -n '$5' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo -n "}' | " >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo -n "awk -F '%' '{print " >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo -n '$1' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo "}')" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo 'if [ $used_percent -gt 95 ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo ' ' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo ' echo "Less than 5% of space remaining on backup drive"' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo ' umount $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo ' rm -rf $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo ' exit 6492' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# MariaDB password' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
echo '# MariaDB password' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
echo -n 'DATABASE_PASSWORD=$(cat ' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
echo -n 'DATABASE_PASSWORD=$(cat ' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||||
|
|
Loading…
Reference in New Issue