2

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)
Mike Pierce
  • 737
  • 1
  • 6
  • 23
aibarra
  • 121
  • 1
  • I believe your problem is the same as the one addressed in [this question here](http://unix.stackexchange.com/questions/284611/). If that solution works, be sure to upvote it and indicate that in this post. – Mike Pierce Oct 19 '16 at 15:48
  • its similar, but the suggestion for using a passwordless key has already been tried. I ended up going back to rsync and that works just fine. I'll have to dig deeper with its options to make sure its doing what I have in mind. Good luck to anyone still trying to make this work. Unison hasn't been updated... in a decade? – aibarra Oct 19 '16 at 20:25
  • 1
    Well, the issue in that question wasn't just about using a passwordless key, but about incron running in a different environment. Anyways, maybe change the line in `incrontab` to redirect stdout and stderr of that command to a log (catch the error there). And [Unison has been updated recently](https://github.com/bcpierce00/unison). 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
  • Also looking at `/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
  • Or change the incron command to: `/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

0 Answers0