Skip to content

Instantly share code, notes, and snippets.

@thunfischbrot
Created February 20, 2018 10:51
Show Gist options
  • Save thunfischbrot/0b6a21a84f166c4fa74fc5df4a470b17 to your computer and use it in GitHub Desktop.
Save thunfischbrot/0b6a21a84f166c4fa74fc5df4a470b17 to your computer and use it in GitHub Desktop.
Unison systemd service
# /etc/systemd/system/[email protected]
# Starts unison with the .prf-config of your choice
# Create a unison .prf-config such as
# https://gist.github.com/thunfischbrot/3efbd4a87785615a61e4f5fd875f2699
# Set the HOME Environment variable below to the user's home dir
# Reload systemd services
# systemctl daemon-reload
# Start service with name of your .prf
# systemctl start unison@20Documents
# systemctl status
# If it is working, add to startup
# systemctl enable unison@20Documents
[Unit]
Description=Unison File Synchronization
After=network.target
[Service]
Type=simple
Environment="PATH=/usr/local/bin:/usr/bin"
# Change to home directory of your user in which the .unison/*.prf files are located
Environment="HOME=/root"
ExecStart=/usr/local/bin/unison %i
Restart=always
RestartSec=7
[Install]
WantedBy=default.target
@GaetanDC
Copy link

GaetanDC commented Oct 2, 2024

from unison -help :
How to sync:
-batch batch mode: ask no questions at all

I use the following command : unison -batch -ui text profile -repeat watch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment