- Create a profile (
~/.unison/bidirsync.prf
):
# Unison preferences
label = bi-directonal sync with server
root = /home/<user>/git
root = ssh://<user>@<server-name>//home/<user>/sync/git
sshargs = -oIdentityFile=/home/<user>/.ssh/<privkey-name>
batch = true
auto = true
repeat = watch
logfile = /home/<user>/.unison/unison.log
#debug=all
- Test the profile with
unison bidirsync
- Create the directory
mkdir -p ~/.config/systemd/user
- Add file
unison.service
:
[Unit]
Description=Unison
[Service]
Environment="PATH=/usr/bin"
ExecStart=/usr/bin/unison bidirsync
#%i
Restart=always
RestartSec=10
[Install]
WantedBy=default.target
- Start/stop the job:
systemctl --user {start|stop} unison
- Check status:
systemctl --user status unison
- Enable/disable background job:
systemctl --user {enable|disable} unison
- Download depwndencies:
sudo apt-get install ocaml python-pyinotify
- Download unison from https://github.com/bcpierce00/unison/releases
- Unpack
- Build and install:
make NATIVE=false && make install
(binaries go to ~)
Depending on the number of files to watch it may be required to increase the number of files that can be watched:
echo fs.inotify.max_user_watches=500000 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p