From 48be8dd112f5d1d210ef015ca7b177a6d0755cce Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 26 Jan 2022 21:38:31 +0100 Subject: [PATCH] rewrite unison --- data/backups/unison.md | 76 +++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 49 deletions(-) diff --git a/data/backups/unison.md b/data/backups/unison.md index 45f7f91..c7f1f6d 100644 --- a/data/backups/unison.md +++ b/data/backups/unison.md @@ -1,67 +1,45 @@ --- title: "unison" -tags: [ "Documentation", "backups" ] +tags: [ "Documentation", "Backups" ] --- -# Local Sync +Install unison on both machines, and on both make the `~/.unison` directory. -unison Dir_A Dir_B +Make a job called `backup`: -Accept defaults with: +> vim ~/.unison/backup.prf -> unison -auto Dir_A Dir_B +All jobs must end in `.prf`. -Ask no questions with: +Here is an example job, which synchronizes the `~/music` directory with a remote machine. -> unison -batch Dir_A Dir_B - -# Remote Sync - -Sync the folders ~/LK on pi and localhost with: - -> unison LK ssh://pi@192.168.0.13/LK - - -#Back Script Example -Make backup script 'rat' by entering the configurations in ~/.unison/rat.prf - -```{r} -# Where to synchronize from -root=/home/roach-1/ - -root=ssh://ubuntu@10.0.3.76/ - -auto = true -batch = true -## for ssh arguments, add as so: -#sshargs=-p 4792 - -## Directories to synchronize -## a path such as 'Album 1' will not work - don't use quotes. -path=box 1 -path=box 2 -path=house -path=.vimrc -path=.bashrc - -ignore=Name temp.* -ignore=Name *.swp - -## Merging -## This line handles the merge, but it's based on Emacs, which cannot run in a tty, but requires X. - -diff = diff -u CURRENT2 CURRENT1 | perl -pe 's/^\+/>/; s/^\-/ unison rat.prf +``` +The last command means it will ignore any file with a name ending in `.flac`. -And a crontab can be set with: +## Automatic Runs -* */4 * * * /usr/bin/unison rat +The first command means this will run but also confirm which files will be deleted, and which will be transferred, us `batch = true` instead. +Set unison to run with crontab or a systemd unit file to have directories synchronize automatically. +## Problem Solving + +Unison is extremely sensitive to version changes. +Both machines must have exactly the same version of unison installed, as well as the same version of `ocaml`. + +Check with: + +> unison -version + +You will see data files summarizing what has happened in the `~/.unison` directory. +If something goes wrong, you may be prompted to delete these to start again.