Originally published July 8, 2016 @ 11:06 am

Think of osync as a kind of rsync that is more suited for making backups. While rsync certainly has more options, osync takes a lot of the complexity out of writing a backup script with a few options that are perfectly suited for such tasks. The dt is a great tool for comparing contents of two or more folders. It can be very useful working in concert with osync to keep track of any changes.

osync installation from a tarball

cd /tmp
wget -q https://github.com/deajan/osync/archive/v1.01.tar.gz -O - | tar xz
cd osync*
./install.sh

osync installation with git
cd /tmp
git clone https://github.com/deajan/osync
cd osync*
./install.sh

Make a more convenient link:
ln -s /usr/local/bin/osync.sh /usr/bin/osync

Example: mirror /etc to /etc_mirror:
CREATE_DIRS=yes osync --initiator="/etc" --target="/etc_mirror"


 

Install dt from a tarball

cd /tmp
wget -q https://github.com/rondilley/difftree/releases/download/v0.5.9/difftree-0.5.9.tar.bz2 -O - | tar xj
cd difftree*
./configure && make && make install

Install dt with git
cd /tmp
git clone https:/github.com/rondilley/difftree.git
cd difftree*
./configure && make && make install

Example: compare /etc and /etc_mirror:
dt -e .osync_workdir /etc /etc_mirror 2>/dev/null