Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
projects:rsyncbackup [2023/02/19 14:06] – [Install] darronprojects:rsyncbackup [2024/07/28 11:30] (current) darron
Line 18: Line 18:
 === Install === === Install ===
  
-Whether you install on a backup server or target host, fetch scripts from repository.+Whether you install on a backup server or target host, fetch scripts from repository and install rsync.
  
 <code> <code>
 +apt install mercurial rsync
 hg clone http://hg.kewl.org/pub/rsync-backup hg clone http://hg.kewl.org/pub/rsync-backup
 </code> </code>
Line 72: Line 73:
 ===Configuration=== ===Configuration===
  
-An RSA ssh key with an empty passphrase must be generated and the public key added to target hosts in authorized_keys on each target for user rsync when using the client installed above, or as a login user otherwise.+An RSA ssh key with an empty passphrase must be generated and the public key added to each target's authorized_keys for user rsync when using the client installed above, or added to for the login user otherwise.
  
 ==Variables== ==Variables==
Line 79: Line 80:
  
 ^ Variable ^ Usage ^ Default ^ ^ Variable ^ Usage ^ Default ^
-|ETCDIR   | rsync host config | /home/rsync/etc |+|ETCDIR   | rsync target host config | /home/rsync/etc |
 |SYNCDIR  | rsync backup directory | /opt/fs/rsync | |SYNCDIR  | rsync backup directory | /opt/fs/rsync |
 |RSYNC    | local and remote rsync command | /home/rsync/bin/rsync| |RSYNC    | local and remote rsync command | /home/rsync/bin/rsync|
 |PURGE    | directory purge command or empty | sudo /home/rsync/bin/purge| |PURGE    | directory purge command or empty | sudo /home/rsync/bin/purge|
  
-==Hosts==+==Target hosts==
  
 Each target host can have up to three server configuration files in ETCDIR. Each target host can have up to three server configuration files in ETCDIR.
Line 112: Line 113:
 <code> <code>
 #! /bin/bash #! /bin/bash
-SSH="ssh -2 -p 2222 -l loginname"+SSH="ssh -2 -p 2222 -l loginname -o StrictHostKeyChecking=no"
 RSYNC_PATH="/bin/rsync" RSYNC_PATH="/bin/rsync"
 </code> </code>
Line 125: Line 126:
  
 When backing up the localhost, just use the hostname and rsync will copy files directly rather than use ssh. When backing up the localhost, just use the hostname and rsync will copy files directly rather than use ssh.
 +
 === Purge === === Purge ===
  
 After each backup operation a directory purge is performed to remove old directories. This can remove temporary data within a backup period and this should be appreciated. After each backup operation a directory purge is performed to remove old directories. This can remove temporary data within a backup period and this should be appreciated.
 +
 +Purging can be disabled if preferred but exists to manage the number of directories over time. A weekly backup to tape or external disk storage would be sensible for important data.
  
 ==Rules== ==Rules==
Line 144: Line 148:
  
 To disable the purge process, set the PURGE variable to "" in the config. To disable the purge process, set the PURGE variable to "" in the config.
 +
 +=== Test===
 +
 +Testing can be performed on the server as user rsync by invoking the host command with one argument.
 +
 +<code>
 +sudo -s
 +/bin/su - rsync
 +./bin/host example
 +</code>
 +
 +example above will extrapolate to example.conf etc
 +
 +===CRON===
 +
 +Cron on the server is utilised to perform daily backups, a typical entry
 +is this
 +
 +<code>
 +0 3 * * * /home/rsync/bin/host >/var/log/rsync/host.log 2>&1
 +</code>
 +
 +=== Export ===
 +
 +[[:projects:rsyncbackup?do=export_pdf|PDF]]
 +