|max.mehl 31105d3875 add REUSE badge||4 months ago|
|LICENSES||6 months ago|
|.drone.yml||5 months ago|
|.gitignore||5 months ago|
|README.md||4 months ago|
|config.cfg.sample||5 months ago|
|hosts.csv.sample||5 months ago|
|ssh-checker.sh||5 months ago|
|uberspace-backup.sh||5 months ago|
This Bash script is able to backup directories from Uberspace users (and also other SSH resources). For Uberspace hosts it can also backup MySQL databases by copying the backups Uberspace cleverly created for you.
It is designed to work automatically on another server with enough harddisk space.
ssh-checker.shone can automatically test whether the hosts provided in the hosts file can be accessed. If not, the little helper is trying to put your public SSH key to the remote hosts’ authorized_keys files by letting you type in the password manually once.
Configuration happens in two files: config.cfg and hosts.csv.
Everything should be self-explanatory with the comments. Make sure to use the correct GPG fingerprint, and make sure to have its public key imported by the user executing the script. No private key has to be installed on the backupping system (but on the decrypting one of course).
This file contains the hosts and its directories that shall be saved. It consists of two rows separated by
;. The first one contains a
username@hostname combination that will be used to sync files via SSH, and also as the backup destination directory name.
The latter one contains all source directories that shall be transferred. This can be absolute file paths, or – if it’s a Uberspace host – some special shortcuts:
%virtualbackups the virtual folder of your uberspace host (
/var/www/virtual/username/) where for example the
htmlfolder is located in.
%mysqldownloads the latest backup of your MySQL databases that have been created by Uberspace themselves (their backup system is quite sophisticated).
%mailsdownloads the directory
usersin the home directory which contains all email files of virtual mail users.
%homesimply downloads the whole user’s home directory.
You can give multiple locations that shall be backed up. Just separate them by
| characters. See the example file for more.
In order to let the script run regularily, simply put the script’s absolute path in a cron file. For example, run
crontab -e and insert at the bottom:
10 3 * * * /home/archiver/uberspace-backup/uberspace-backup.sh
This will run the backups every night at 3:10.
$HOMEhaven’t been tested yet. Use absolute paths instead.
%virtual. Make sure to regularily check your backups to make sure all important files are saved.