Backup with rsnapshot

From Andreida
Revision as of 11:37, 16 February 2016 by Andreas (talk | contribs) (Created page with "* install apt-get install rsnapshot * edit /etc/rsnapshot.conf ** enable cmd_cp ** enable cmd_du cmd_du /usr/bin/du ** enable the schedule interval hourly 6 interval ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  • install
apt-get install rsnapshot
  • edit /etc/rsnapshot.conf
    • enable cmd_cp
    • enable cmd_du
cmd_du /usr/bin/du
    • enable the schedule
interval    hourly  6
interval    daily   7
interval    weekly  4
interval    monthly 3
    • add directories to backup
backup  /etc/       localhost/
backup  /var/www/home/  localhost/
    • add script to use to generate files which you want to backup
backup_script   /root/bin/backup_my_db localhost/dbbackup/
  • create the db-backup script, in this case /root/bin/backup_my_db
#!/bin/bash
mysqldump -u<USER> -p'<PASSWORD>' --all-databases   > mysql_backup.sql
  • enable the cronjobs
0 */4 * * * /usr/bin/rsnapshot hourly
50 23 * * * /usr/bin/rsnapshot daily
40 23 * * 6 /usr/bin/rsnapshot weekly
30 23 1 * * /usr/bin/rsnapshot monthly