I'm new to unison, and am trying to use its options in a simple shell script, but they seem to be ignored when the script is executed, causing no changes to be synced between the two servers.
My shell script:
#!/bin/bash
# set paths / dirs
_paths="/var/www/html/ \
"
# binary file name
_unison=/usr/bin/unison
# Log in to remote server without a password
source $HOME/.keychain/$HOSTNAME-sh
# server names
# sync node1.example.com with rest of the servers in cluster
_rserver="node2.example.com"
# sync it
for r in ${_rserver}
do
for p in ${_paths}
do
${_unison} -batch -time -owner -group "${p}" "ssh://${r}/${p}"
done
done
If i remove the -time -owner -group
options, the script syncs changes made fine.
If i add the options to the ~/.unison/default.prf
file instead then the script executes successfully. e.g.
# Unison preferences file
prefer=newer
times=true
group = true
owner = true
However. Since I have different scripts being called by different cron jobs, I'd prefer to have the options stated in the scripts themselves as opposed to preference files.
Any suggestions on what I'm doing wrong?