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 20:57] oemb1905computing:rsyncrsnapshot [2023/04/10 21:03] oemb1905
Line 7: Line 7:
 ------------------------------------------- -------------------------------------------
  
-Since I am backing up multiple remote hosts, I chose to create separate configs for each remote host instead of putting those destinations in the ''/etc/rsnapshot.conf'' together with the localhost/backup server. The localhost configuration is as follows:+Since I am backing up multiple remote hosts, I chose to create separate configs for each remote host instead of putting those destinations in the ''/etc/rsnapshot.conf'' together with the localhost/backup server. I have the config set to retain 90 days worth of backups called "alpha" and it is set to sync first. The localhost configuration is as follows:
  
   #base config    #base config 
Line 30: Line 30:
   backup                  /var/www/                                       www/   backup                  /var/www/                                       www/
      
-Then, to run this, I use a simple script I created.+Then, to run this, I use a simple script I created. Again, this script is just for running the localhost, so it can also be used for someone's single desktop: 
 + 
 +  #!/bin/bash 
 +  service="/usr/bin/rsnapshot" 
 +  logfile="/home/logs/tempa.log" 
 +          START1="$(date +%s)" 
 +          touch $logfile 
 +          $service -V sync > $logfile 
 +          END1="$(date +%s)" 
 +          DURATION1=$[ ${END1} - ${START1} ] 
 +          MINUTES=$[ ${DURATION1} / 60 ] 
 +          sed -i "1s/^/Jonathan, at $(date), the rsnapshot sync took exactly ${DURATION1} seconds which is approximately ${MINUTES} minutes to complete.\n/" $logfile 
 +  if 
 +          tail -n -5 $logfile | grep "completed" 
 +  then 
 +          START1="$(date +%s)" 
 +          echo "Jonathan, at $(date), the sync has completed and I am now running alpha." 
 +          $service -V alpha >> $logfile 
 +          END1="$(date +%s)" 
 +          DURATION1=$[ ${END1} - ${START1} ] 
 +          MINUTES=$[ ${DURATION1} / 60 ] 
 +          sed -i "1s/^/Jonathan, at $(date), the rsnapshot alpha took exactly ${DURATION1} seconds which is approximately ${MINUTES} minutes to complete.\n/" $logfile 
 +          mail -s "[$(hostname -f)]-rsnap-success-$(date)" alerts@alerts.com < $logfile 
 +          rm $logfile 
 +          chown sexa:sexa -R /mnt/backups/rsnapback/localhost.domain/ 
 +          chmod 770 -R /mnt/backups/rsnapback/localhost.domain/ 
 +  else 
 +          echo "Jonathan, at $(date), the sync has failed and I am now notifying you." 
 +          mail -s "[$(hostname -f)]-rsnap-failure-$(date)" alerts@alerts.com < $logfile 
 +          rm $logfile 
 +  fi 
  
  
computing/rsyncrsnapshot.txt · Last modified: 2023/04/10 21:29 by oemb1905