I am not coder, so do not laugh for this commands or setting. For me, they are working, and that is most important:
Change settings for your forum, and username and pass too.
Below are pure database & files commands. Better try to find full path to command
Database backup script
Code:
#!/bin/bash
/usr/bin/mysqldump --opt database_name > /path/to/database/backup/folder/database_backup_`date +%d-%m-%Y---%H-%M`.sql
Database clean script (delete backup database older than 5 days)
Code:
#!/bin/bash
/bin/find /path/to/database/backup/folder -mtime +3 -type f -exec rm -f {} \;
Files backup script (gzipped)
Code:
#!/bin/bash
/usr/bin/tar -cf - /path/to/domain/folder | /bin/gzip -c > /path/to/files/backup/folder/files_backup_`date +%d-%m-%Y---%H-%M`.tar.gz
Files clean script (delete backup gziped backup file older than 10 hours)
Code:
#!/bin/bash
/bin/find /path/to/files/backup/folder -mmin +10 -type f -exec rm -f {} \;
Save all four as script (some_name.sh), put in to some folder and call it with crontab in desired name. Delete script execute before save script, for both (delete database - save database - delete files - save files), and give time for work.
And after all that, I call Rsnapshot installed on backup server to rsync all backup folders and pure domain directory.
So in the end I have database backup (gzipped and not zipped both on server), one database on dropbox, gzipped domain directory on server and all of that on backup server too