26 lines
666 B
Bash
26 lines
666 B
Bash
#!/bin/bash
|
|
|
|
date=$(date +"%d-%m-%Y@%H-%M")
|
|
|
|
# Settings
|
|
backup_path=/backups/BookStack/
|
|
rclone_backup_path=systems-sharepoint:Systems/Backups/BookStack/
|
|
mysql_user=root
|
|
mysql_pass=YOURPASSWORDHERE
|
|
|
|
cd $backup_path
|
|
|
|
# Dump the MariaDB database
|
|
mysqldump -u $mysql_user -p $mysql_pass 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 $backup_path -type f -mtime +7 -name '*.gz' -delete
|
|
|
|
# Add your desired rclone options below
|
|
rclone sync $backup_path $rclone_backup_path |