What is the simplest way to unidirectional incremental syncing of a folder present on a Linux system.
+1 for using the command line. +2 for not using rsync (Seems to have some problems on my system.)
csync is a file synchronizer especially designed for you, the normal user.
csync is a library and ships commandline client by default. It is server-less and allows synchronisation through either sftp
or samba
.
Usage examples:
csync /home/csync smb://csync:[email protected]/Users/csync
csync /home/csync sftp://[email protected]:2222/home/csync
csync
command is provided by the csync-owncloud
ubuntu package. (sudo apt-get install csync-owncloud
libcsync-plugin-sftp libcsync-plugin-smb
if you want them as well)
Jul 21, 2015 at 20:08
I think you should solve your problems with rsync, that is the tried and true" syncronization tool for unixes.
rsync -uav --delete /loal/path example.com:/remote/path
Note: For bidirectional sync, you can use unison as well as csync.
rsync
over ssh, use rsync -uav --delete -e ssh remoteuser@remotehost:/remote/dir /this/dir/
This is how I would do a unidirectional sync with bare tools.
At the onset, tar the entire set of files and copy them to the destination point.
Also, setup a marker in the base directory.
touch /Source/base/directory/last-sync-time.txt
Now, we want to keep sync'ing from Source to Destination.
At the next time slot for syncing forward (from Source to Destination),
# The backup script
cd /Source/base/directory
tar cfj -N ./last-sync-time.txt backup.tar.bz2 .
scp backup.tar.bz2 user@backup-server:/Backup/Directory/
touch /Source/base/directory/last-sync-time.txt
rm -f backup.tar.bz2
-N ./filename
tells tar to archive only files modified or created after filename
was modified/created.
scp
with public key authenticationbackup-server
whenever this script is issued.touch
commandtar.bz2
archives.I Use this short script for monitoring and continually synchronizing a directory with remote sftp folder;
#!/bin/sh
dir1=/home/user/folder
while inotifywait -qqre modify "$dir1";
do
csync /home/user/folder sftp://remoteuser:remotepass@remoteaddress:remoteport/remotefolderpath
done
rsync
very likely is the simplest answer, explain what problems you're having with that. (The problems may spill over to any other solution, anyhow.)