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.)
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:secret@rupert.galaxy.site/Users/csync
csync /home/csync sftp://csync@krikkit.galaxy.site:2222/home/csync
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