I have successfully installed unison and incron. I get unison to run just fine. I'm doing this all logged in as root by the way, I figure that's how this will be executed when i'm not logged in. I'm using ssh, and have a passwordless key file. I can successfully call unison and have it sync just fine. I can call the shellscript and that works too. But Nothing happens when the incron is triggered and unison is called. I also modified my incrontab to run unison directly and that doesn't work. And I don't see any errors. any help would be greatly appreciated! I'm still getting use to linux.
Unison default.prf
# Unison preferences file
sshargs = -i uni
batch = true
silent = true
log = true
logfile = /var/log/unison.log
root = /var/www
root = ssh://ipaddress//var/www/
path = test
ignore = Name test/sub2/suber
confirmbigdel = false
Incrontab -e
/var/www/test/ IN_ALL_EVENTS /root/au.sh
au.sh
#!/bin/bash
unison -batch
I can run my shellscript just fine. I'm adding the batch flag again just for kicks. I know that incrontab is working, I see output in the /var/log/sys.log
Oct 18 19:38:27 inctrg-dev-01 incrond[682]: (root) CMD (/root/au.sh)
incrontab
to redirect stdout and stderr of that command to a log (catch the error there). And Unison has been updated recently. It's just that since all the versions of Unison have to be the same on each machine being synced, many old versions are used by default. But really I doubt this is an issue with Unison anyways since it works fine when you run it manually. – Mike Pierce Oct 20 '16 at 00:43/var/log/unison.log
would have been the first thing to do (yeah, I know, I always forgot to read the logs too!). As the script is run, then unison would be run and must output something useful. – Yvan Dec 01 '18 at 19:14/root/au.sh 2>&1 >> /root/au.log
so that all errors are logged before the unison is invoked. – Yvan Dec 01 '18 at 19:17