From 8eac267554e80bfd89e4f19387f24825b69e15f4 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Berkleef" Date: Thu, 6 May 2021 22:02:00 -0300 Subject: [PATCH] Make the script functional --- bookstack-backup.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/bookstack-backup.sh b/bookstack-backup.sh index cd13cb4..78997ac 100644 --- a/bookstack-backup.sh +++ b/bookstack-backup.sh @@ -3,6 +3,20 @@ date=$(date +"%d-%m-%Y@%H-%M") # Add your backup path here -cd /backups/BookStack +backuppath=/backups/BookStack/ +cd $backuppath -# dump the MariaDB database +# Dump the MariaDB database +mysqldump -u root -p bookstack > bookstack_db.sql + +# Compress the SQL dump and the BookStack files +tar cvf bookstack_backup_$date.tar.gz bookstack_backup.sql /var/www/BookStack + +# Delete temporary .sql +rm -rf bookstack_db.sql + +# Delete backups older than 7 days +find $backuppath -type f -mtime +7 -name '*.gz' -delete + +# Add your desired rclone options below +rclone sync $backuppath systems-sharepoint:Systems/Backups/BookStack/ \ No newline at end of file