Linux tool for backing up data to a remote server using rsync.
- Ensure that ssh keys are properly set up between local and remote hosts.
- Create a backup directory called e.g.
backup
in your home directory. - Copy the
backup
script to backup directory. - Create directories you want to backup in the backup directory. In case you have already directories in other places, moving them to backup directory and symlinking to original locations might be a convenient solution.
- Copy sample configuration file
.backup
to backup directory and set correct remote host credentials and backup file list there.
The simplest way to use this tool is to manually execute backup when needed. This is done as follows:
$ cd ~/backup
$ ./backup
Files are restored in the following way:
$ cd ~/backup
$ ./backup restore
Backups can be automated using a systemd timer. For example, configuration in systemd user mode is done as follows:
-
Copy systemd service and timer:
$ cp systemd/* ~/.config/systemd/user/ $ sudo systemctl --user enable oturpe-backup.timer
-
Edit copied
oturpe-backup.service
file and set parametersWorkingDirectory
andExec
to match the backup directory. -
Reload systemd daemon and enable timer:
$ systemctl --user daemon-reload $ systemctl --user enable oturpe-backup.timer
-
Check that the timer is running:
$ systemctl --user status oturpe-backup.timer ● oturpe-backup.timer - Backup personal files daily Loaded: loaded (/home/otto/.config/systemd/user/oturpe-backup.timer; enabled; Active: active (waiting) since su 2017-06-04 12:30:05 CEST; 30min ago kesä 04 12:30:05 ottovain systemd[1525]: Started Backup personal files daily