A bundle of scripts, that contain few simple solutions for backup, which I'm using within my Ubuntu installations.
-
This solution perfectly fits to 'desktop' systems, when you want easy access to your backup files and their history.
-
It is based on this nice answer, provided by PerlDuck on Ask Ubuntu SE, where are provided detailed explanations.
-
There are two files:
-
incremental_backup- this is the main (bash) script. I would place it in/usr/local/binto be accessible as shell command system wide. -
incremental_backup_cron- this a (sh) script desingned to be placed in/etc/cron.{daily,hourly,weekly}/.
-
-
Installation on fly (without using git):
sudo wget -O /usr/local/bin/incremental_backup https://raw.githubusercontent.com/metalevel-tech/simple-backup-solutions/master/incremental_backup sudo chmod +x /usr/local/bin/incremental_backup sudo wget -O /etc/cron.daily/incremental_backup_cron https://raw.githubusercontent.com/metalevel-tech/simple-backup-solutions/master/incremental_backup_cron sudo chmod +x /etc/cron.daily/incremental_backup_cron
-
This solution perfectly fits to 'server' systems, when you want small and portable backups.
-
It is based on this answer of mine on Ask Ubuntu SE, where are provided detailed explanations.
-
There are two files:
-
portable_backup- this is the main (bash) script. I would place it in/usr/local/binto be accessible as shell command system wide. -
portable_backup_cron- this a (sh) script desingned to be placed in/etc/cron.{daily,hourly,weekly}/.
-
-
Installation on fly (without using git):
sudo wget -O /usr/local/bin/portable_backup https://raw.githubusercontent.com/metalevel-tech/simple-backup-solutions/master/portable_backup sudo chmod +x /usr/local/bin/portable_backup sudo wget -O /etc/cron.daily/portable_backup_cron https://raw.githubusercontent.com/metalevel-tech/simple-backup-solutions/master/portable_backup_cron sudo chmod +x /etc/cron.daily/portable_backup_cron
-
This solution is designed for systems running LXD, where you manage remote LXC containers over a forwarded SSH/LXD connection and want dated local snapshots of each container along with the host LXD configuration.
-
What the script does:
- Starts a local SSH forward service (
sshfwd-cvps.service) if the LXD API port (8443) is not yet reachable. - Waits until the remote LXD is accessible and a known test container is visible.
- Exports every container on the remote LXD host to a dated
.tar.gzfile in the local backup directory. - Dumps the remote LXD
initconfiguration via SSH to a dated.yamlfile. - Rsync-pulls any additional backup files from the remote host's backup directory.
- Purges local backup files older than 14 days.
- Starts a local SSH forward service (
-
One file:
lxc-remote-backup.sh- edit the variables at the top of the script to match your environment, then run it manually or schedule it via cron / systemd timer.
-
Key variables to configure:
Variable Description BACKUP_DIRLocal directory where exports are stored SSH_HOSTSSH host alias for the remote server REMOTE_LXDLXD remote name (as registered with lxc remote add)TEST_LXC_CONTAINERA container name used to verify the connection REMOTE_BACKUP_DIRPath on the remote host to rsync from -
Installation on fly (without using git):
sudo wget -O /usr/local/bin/lxc-remote-backup https://raw.githubusercontent.com/metalevel-tech/simple-backup-solutions/master/lxc-remote-backup.sh sudo chmod +x /usr/local/bin/lxc-remote-backup
- Restore LXC via remote instance by Spas Z. Spasov (pa4080)
- SSH Persistent Tunnel by Spas Z. Spasov (pa4080)
- How to rsync multiple source folders - on Unix & Linux
- Make "rm" move files to trash instead of completely removing them - on WEB UPD8
- Command to move a file to Trash via Terminal - on Ask Ubuntu
- How to compare two dates in a shell - on Unix & Linux
- Exhaustive list of backup solutions for Linux - on GitHub