Hi,
Yet again I've lost hours struggling with a trivial quirk, so hoping for a pointer.
I have ssh with keys set up on machines on a home network so unison can run in batch mode to 2-way sync files on a laptop and netbook with a 'main' desktop (star pattern). It all works reliably in manual mode (where I can see the unison gui), but when invoked by crontab the behaviour is flaky, unison runs in invisible mode which is expected but synchronisation does not always occur.
The scheduled (invisible) version only effects a sync if I have previously (in the same computing session) run a visible instance of unison first. If I turn on a laptop without running the visible version of unison on it first, then cron runs the script I have written to invoke unison, but no synchronisation actually takes place (don't know how to tell if unison is actually invoked or not as it runs invisibly in that case). If I fire up unison in graphical mode (by manually running the same script -i.e. clicking on it), let it do a sync and close it, then the cron version runs invisibly but effectively until the next time 'something goes to sleep'.
Any ideas to explain the patchy behaviour, and what I need to do to make things work reliably in auto mode without first running unison in graphical mode?
I realise there could be a problem with remote machines trying to sync with the main machine at the same moment, but have tested and found the problem above occurs when only two machines are turned on (main and laptop for example).
Here's the script (tested with two versions of unison invocation - one is commented out). I add a line to copy a local file so I can test whether the script ran by seeing if the file is copied over. If it is I know the script is running at the correct intervals. The problem is not with running the script but with unison invocation or behaviour.
script (cronRunUnisonx):
Code:
#!/bin/bash
#/usr/bin/unison-2.27.57-gtk syncFiles -batch
unison syncFiles -batch
crontab entry
Code:
~$ crontab -l
# m h dom mon dow command
*/1 * * * * /home/j/Docs/Computing/Maintenance/Sync/cronRunUnisonx
running on Ubuntu Karmic 9.10
Thanks