Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
projects:rsyncbackup [2023/02/19 02:33] – [Install] darron | projects:rsyncbackup [2024/11/04 00:27] (current) – [Purge] 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 |
< | < | ||
+ | apt install mercurial rsync | ||
hg clone http:// | hg clone http:// | ||
</ | </ | ||
Line 64: | Line 65: | ||
For user only backup on a target, the requirements are ssh access and rsync | For user only backup on a target, the requirements are ssh access and rsync | ||
being available. If these two cases are met then when configuring the host, | being available. If these two cases are met then when configuring the host, | ||
- | the login parameters and path to rsync must be set. | + | the login parameters and path to rsync must be set in the target config (see below). |
__ssh__ | __ssh__ | ||
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 |
==Variables== | ==Variables== | ||
Line 79: | Line 80: | ||
^ Variable ^ Usage ^ Default ^ | ^ Variable ^ Usage ^ Default ^ | ||
- | |ETCDIR | + | |ETCDIR |
|SYNCDIR | |SYNCDIR | ||
|RSYNC | |RSYNC | ||
|PURGE | |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: | ||
< | < | ||
#! /bin/bash | #! /bin/bash | ||
- | SSH=" | + | SSH=" |
RSYNC_PATH="/ | RSYNC_PATH="/ | ||
</ | </ | ||
Line 124: | Line 125: | ||
|RSYNC_PATH | |RSYNC_PATH | ||
+ | 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. | ||
+ | |||
+ | Purge 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. | ||
+ | |||
+ | Purge could also be disabled in the config and then ran at a different time interval from cron Eg. weekly or fortnightly. | ||
==Rules== | ==Rules== | ||
Line 144: | Line 150: | ||
To disable the purge process, set the PURGE variable to "" | To disable the purge process, set the PURGE variable to "" | ||
+ | |||
+ | === Test=== | ||
+ | |||
+ | Testing can be performed on the server as user rsync by invoking the host command with one argument. | ||
+ | |||
+ | < | ||
+ | sudo -s | ||
+ | /bin/su - rsync | ||
+ | ./bin/host example | ||
+ | </ | ||
+ | |||
+ | example above will extrapolate to example.conf etc | ||
+ | |||
+ | ===CRON=== | ||
+ | |||
+ | Cron on the server is utilised to perform daily backups, a typical entry | ||
+ | is this | ||
+ | |||
+ | < | ||
+ | 0 3 * * * / | ||
+ | </ | ||
+ | |||
+ | === Export === | ||
+ | |||
+ | [[: | ||
+ | |||