I want two way data sync between two CentOS
based servers, so I installed Unison
on both of my CentOS
servers. I made a script file on root which runs unison and works fine, and syncs the files, when I run it from terminal. When I put that script in the crontab the sync simply does not work.
My /etc/crontab
is
*/1 * * * * root sh /root/syncaaa.sh &>/root/unison-cron.log
And what crontab puts in the /root/unison-cron.log
Usage: unison [options]
or unison root1 root2 [options]
or unison profilename [options]
For a list of options, type "unison -help".
For a tutorial on basic usage, type "unison -doc tutorial".
For other documentation, type "unison -doc topics".
My unison.log file does not updated when run via cron, but only updates when runs directly via terminal. I checked in cron logs and syncaaa.sh file runs every miunte. Can anyone suggest me what I should do to debug it?
Note: My server 1 can login to server 2 without password, as I have set rsa keys in server2 authorized_keys.
> Update 1: I tried set -x
in the script and it printed
+ chmod -R 0777 /home/user11/folder/
+ /usr/bin/unison
Usage: unison [options]
or unison root1 root2 [options]
or unison profilename [options]
For a list of options, type "unison -help".
For a tutorial on basic usage, type "unison -doc tutorial".
For other documentation, type "unison -doc topics"
and /usr/bin/unison
command works fine on terminal