User Tools

Site Tools


computing:rsyncrsnapshot

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
computing:rsyncrsnapshot [2023/04/10 21:03] oemb1905computing:rsyncrsnapshot [2023/04/10 21:12] oemb1905
Line 61: Line 61:
           rm $logfile           rm $logfile
   fi   fi
 +
 +Then, in ''/etc/cron.d/rsnapshot'', I set up a cronjob to run this script on a schedule. For my particular use case, twice a day is sufficient, but this can obviously be adjusted to the user's needs:
 +
 +  0 0,14 * * * root /bin/bash /usr/local/bin/rsnap-alpha-netback.jonathanhaack.com.sh > /dev/null 2>&1
 +
 +Now that the localhost/backup server is backing up it's own essential boot volume files to the backup zpool, it's time to create the configs and scripts for the remote hosts. In my case, I have over 15 remote hosts set up this way, so I will highlight the setup for one in order to demonstrate what I've done. First, create a directory for the configs such as ''/etc/rsnapshot/'' and then create a config file within it such as ''/etc/rsnapshot/rsnapshot-domain.com.conf''. The config for the remote host looks very similar to the localhost config, but it has syntax for connecting to the remote host. Of course, make sure that you have properly exchanged ssh keys and installed rsync on the remote host before proceeding:
 +
 +  #base config 
 +  config_version          1.2
 +  snapshot_root           /mnt/backups/rsnapback/domain.com/
 +  cmd_cp                  /bin/cp
 +  cmd_rm                  /bin/rm
 +  cmd_rsync               /usr/bin/rsync
 +  cmd_ssh                 /usr/bin/ssh
 +  cmd_logger              /usr/bin/logger
 +  verbose                 2
 +  loglevel                3
 +  logfile                 /var/log/rsnapshot.log
 +  sync_first              1
 +  use_lazy_deletes        1
 +  retain                  alpha                                  90
 +  #directories
 +  backup                  root@domain.com:/etc/                  etc/
 +  backup                  root@domain.com:/usr/local/bin/        bin/
 +  backup                  root@domain.com:/var/www/              www/
 +  backup                  root@domain.com:/home/                 home/
 +  backup                  root@domain.com:/root/                 root/
 +
 +Now that the config is setup, you use a script very similar to the localhost script above, but note the syntax changes for sync and alpha that will specify to rsnapshot to use this particular configuration file:
 +
 +
 +
  
  
computing/rsyncrsnapshot.txt · Last modified: 2023/04/10 21:29 by oemb1905