Preamble
I’m using Unison for file synchronization between my local MacBook Pro and a remote server. The synchronization is inconsistent: sometimes it works perfectly, but other times it stops detecting changes.
Unison sometimes fails to detect new files added to the remote directory, though it picks up changes from the local directory usually, but sometimes even then, it doesn’t. For example, it did not detect “cs241/a1/a1q5/self-modifying.mips”. I killed the process and restarted it using a script with nohup. This temporarily resolved the issue, but after a few minutes, Unison stopped detecting remote changes again, though local changes were still synchronized.
Question:
Why does Unison inconsistently detect new files, and how can I ensure it always picks up changes?
Additional Information:
Unison version: 2.53.5
Configuration includes repeat = watch for real-time monitoring.
Any insights or suggestions would be greatly appreciated
Unison log Excerpt:
Unison 2.53.5 (ocaml 5.1.0): Contacting server...
Connected [//local-machine.local//Users/username/uw -> //remote-server//remote/path]
Looking for changes
Waiting for changes from server
Reconciling changes
<---- new file **cs241/a1/a1q5/self-modifying.mips**
1 items will be synced, 0 skipped
0 B to be synced from local to remote-server
36 B to be synced from remote-server to local
Propagating updates
Unison 2.53.5 (ocaml 5.1.0) started propagating changes at 20:43:21.62 on 19 May 2024
[BGN] Copying cs241/a1/a1q5/self-modifying.mips from //remote-server//remote/path to /Users/username/uw
[END] Copying cs241/a1/a1q5/self-modifying.mips
Unison 2.53.5 (ocaml 5.1.0) finished propagating changes at 20:43:21.73 on 19 May 2024, 0.119 s
Saving synchronizer state
Synchronization complete at 20:43:21 (1 item transferred, 0 skipped, 0 failed)
Looking for changes
Waiting for changes from server
Reconciling changes
Nothing to do: replicas have not changed since last sync.
Processes running:
ps aux | grep unison
username 3132 0.0 0.0 410724048 1344 s001 S+ 9:16pm 0:00.00 grep unison
username 3019 0.0 0.1 411474560 12800 s001 SN 8:43pm 0:00.94 /opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python /opt/homebrew/bin/unison-fsmonitor
username 3018 0.0 0.0 411175072 4048 s001 SN 8:43pm 0:00.13 ssh -l remoteuser remote.server.com -e none unison -server __new-rpc-mode
username 3011 0.0 0.0 412093776 4832 s001 SN 8:43pm 0:00.32 unison sync.prf
...
This script is sourced in my ~/.zshrc:
#!/bin/zsh
#Define the log file path
LOG_FILE="/Users/username/Library/Application Support/Unison/unison.log"
#Check if a Unison process is already running
if pgrep -f "unison sync.prf" > /dev/null; then
echo "Unison UW Sync process is already running. Exiting."
exit 1
else
#Start the Unison process with nohup
nohup unison sync.prf > "$LOG_FILE" 2>&1 &
echo "Unison UW Sync process started."
fi
Sync.prf
#Root directories
root = /Users/username/uw
root = ssh://[email protected]//directory
#Automatically synchronize changes
auto = true
batch = true
repeat = watch
#Ignore dot files
ignore = Name .*
What I’ve Tried:
- Ensured unison-fsmonitor is running.
- Checked the Unison log for errors or warnings.
- Verified network connectivity and permissions.
- Restarted the Unison process multiple times.
- Killed the process using pkill -f unison and then restarted it using
nohup unison sync.prf > /Users/username/Library/Application Support/Unison/unison.log 2>&1 &.