2021-05-07 00:47:47 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
date=$(date +"%d-%m-%Y@%H-%M")
|
|
|
|
|
|
|
|
# Add your backup path here
|
2021-05-07 01:02:00 +00:00
|
|
|
backuppath=/backups/BookStack/
|
|
|
|
cd $backuppath
|
2021-05-07 00:47:47 +00:00
|
|
|
|
2021-05-07 01:02:00 +00:00
|
|
|
# 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/
|