Search code examples
cronsynchronizationubuntu-22.04unison

Unison: fatal error failure reading from the standard input


When calling a unison command from crontab it produces this error: "Fatal error: failure reading from the standard input (End of file)". Example crontab line:

*/5 * * * * USER test -e /var/lock/unison-SCRIPT && exit 0 || (touch /var/lock/unison-SCRIPT;unison SCRIPT;rm /var/lock/unison-SCRIPT)

It first checks the LOCK, sets the LOCK, issues the command, removes the LOCK. The SCRIPT.prf is as follows:

# Unison preferences
label = Some text describing unidirectional sync
root = /home/USER/SOME/LOCAL/PATH
root = /home/USER/ANOTHER/LOCAL/PATH
logfile = SCRIPT.log
force = /home/USER/SOME/LOCAL/PATH

Version: Unison 2.51.5 (ocaml 4.13.1)

I tried to reproduce the error from the command line, but there sync worked well:

> unison SCRIPT

The error first occured after upgrading from Ubuntu 20.04.3 LTS to Ubuntu 22.04.3 LTS.


Solution

  • Adding batch = true to the unison preferences solved the problem.