Server Backups
m (Clive moved page Favog Wiki Backups to Server Backups) |
No edit summary |
||
Line 1: | Line 1: | ||
[[Category:IT]] | [[Category:IT]] | ||
Crontab for <code>gonzo</code> | |||
# m h dom mon dow command | |||
# every night (at 5am) back up all databases to merple | |||
0 5 * * * /root/backup_scripts/nightly_backup.sh > /var/log/nightly_backup.log 2>&1 | |||
# local backup jobs | |||
# give Matt a back up of the sql server databases every 4 hours | |||
0 */4 * * * /root/backup_scripts/sqlserver_backup.sh HOUR > /var/log/hour_backup.log 2>&1 | |||
# every Monday | |||
0 4 1 * * /root/backup_scripts/sqlserver_backup.sh WEEK > /var/log/weekly_backup.log 2>&1 | |||
# and on the 1st of the month | |||
0 4 1 * * /root/backup_scripts/sqlserver_backup.sh MONTH > /var/log/monthly_backup.log 2>&1 | |||
The | == The Scripts == | ||
Scripts are located in <code>/root/backup</code>. | |||
=== Nightly backup === | |||
The nightly back copies everything to <code>merple</code>. It: | |||
# mounts <code>/mnt/backup</code> to <code>//merple/backups</code>. | |||
# iterates over the <code>ms sqlserver</code> databases, backing them up to <code>/mnt/backup/sqlserver/$DAY</code> | |||
# iterates over the <code>mariadb> databases, backing them up to <code>/mnt/backup/mysql/$DAY</code> | |||
# copies the apache config to <code>/mnt/backup/apache2-config/</code> | |||
# copies the ssl config to <code>/mnt/backup/ssl-config/</code> | |||
# finally, using rsync directly because smb has no compression and it's too slow otherwise, it copies <code>/var/www/html</code> directly to <code>merple:/srv/backups/websites/</code> | |||
=== Other backups === | |||
In order to give Matt the ability to roll back any damaging database changes (or recover historical data), we back up the MS Sql Server every 4 hours, every Monday and on the first day of the month. These go to <code>/var/opt/mssql/data/backups/$BACKUP_FOLDER</code> and Matt can restore from them using Sql Server Manager. | |||
Revision as of 13:54, 26 July 2024
Crontab for gonzo
# m h dom mon dow command # every night (at 5am) back up all databases to merple 0 5 * * * /root/backup_scripts/nightly_backup.sh > /var/log/nightly_backup.log 2>&1 # local backup jobs # give Matt a back up of the sql server databases every 4 hours 0 */4 * * * /root/backup_scripts/sqlserver_backup.sh HOUR > /var/log/hour_backup.log 2>&1 # every Monday 0 4 1 * * /root/backup_scripts/sqlserver_backup.sh WEEK > /var/log/weekly_backup.log 2>&1 # and on the 1st of the month 0 4 1 * * /root/backup_scripts/sqlserver_backup.sh MONTH > /var/log/monthly_backup.log 2>&1
The Scripts
Scripts are located in /root/backup
.
Nightly backup
The nightly back copies everything to merple
. It:
- mounts
/mnt/backup
to//merple/backups
. - iterates over the
ms sqlserver
databases, backing them up to/mnt/backup/sqlserver/$DAY
- iterates over the
mariadb> databases, backing them up to
/mnt/backup/mysql/$DAY
- copies the apache config to
/mnt/backup/apache2-config/
- copies the ssl config to
/mnt/backup/ssl-config/
- finally, using rsync directly because smb has no compression and it's too slow otherwise, it copies
/var/www/html
directly tomerple:/srv/backups/websites/
Other backups
In order to give Matt the ability to roll back any damaging database changes (or recover historical data), we back up the MS Sql Server every 4 hours, every Monday and on the first day of the month. These go to /var/opt/mssql/data/backups/$BACKUP_FOLDER
and Matt can restore from them using Sql Server Manager.