diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cb3223..b87a502 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,24 +1,26 @@ -SHORT FUTURE IMPROVEMENTS (post v1.0) -------------------------------------- +SHORT FUTURE IMPROVEMENTS +------------------------- -- Tree functions execute piped commands (grep, awk) on master when launched on remote slave which can cause more bandwith usage -- SysV init script for RHEL / CentOS +- Tree functions execute piped commands (grep, awk) on local system when launched on remote slave which can cause more bandwith usage FAR FUTURE IMPROVEMENTS ----------------------- -- Rethink of .osync_workdir/state/* files with PIDs, Host and Task Names to better identify multiple instances on the same fileset -- Improve Master / Slave schema to Multimaster schema -- State files should exist per replica for Multimaster schema +- MultiMaster support + - Rethink of .osync_workdir/state/* files with PIDs, Host and Task Names to better identify multiple instances on the same fileset + - Improve Master / Slave schema to Multimaster schema + - State files should exist per replica for Multimaster schema KNOWN ISSUES ------------ -- None yet, need more testing on MSYS environment and MacOS X +- Still need more testing on BSD, MacOSX and Windows MSYS RECENT CHANGES -------------- +- Fixed some typos (thanks to Pavel Kiryukhin) +- Added a simple RHEL / CentOS compatible init script - Fixed a bug with double trailing slashes in certain sceanrios - Sync execution don't fails anymore if files vanish during execution, also vanished files get logged - Add eventual "comm -23" replacement by "grep -F -x -v -f" to enhance compatibility with other platforms (comm is still much faster than grep, so we keep it) diff --git a/osync.sh b/osync.sh index 3446a18..ca65200 100755 --- a/osync.sh +++ b/osync.sh @@ -4,7 +4,7 @@ PROGRAM="Osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" PROGRAM_VERSION=0.99preRC3 -PROGRAM_BUILD=1901201409 +PROGRAM_BUILD=0903201401 DEBUG=no SCRIPT_PID=$$ @@ -74,7 +74,8 @@ function LogDebug fi } -function TrapError { +function TrapError +{ local JOB="$0" local LINE="$1" local CODE="${2:-1}" @@ -84,6 +85,11 @@ function TrapError { fi } +function TrapUsr1 +{ + echo "Still doing stuff" +} + function TrapStop { if [ $soft_stop -eq 0 ] @@ -1466,18 +1472,18 @@ function Init then if [ "$RSYNC_REMOTE_PATH" != "" ] then - RSYNC_PATH="sudo $(type -p $RSYNC_REMOTE_PATH)/$RSYNC_EXECUTABLE)" + RSYNC_PATH="sudo $RSYNC_REMOTE_PATH/$RSYNC_EXECUTABLE" else RSYNC_PATH="sudo $RSYNC_EXECUTABLE" fi COMMAND_SUDO="sudo" else if [ "$RSYNC_REMOTE_PATH" != "" ] - then - RSYNC_PATH="$(type -p $RSYNC_REMOTE_PATH)/$RSYNC_EXECUTABLE)" - else - RSYNC_PATH="$RSYNC_EXECUTABLE" - fi + then + RSYNC_PATH="$RSYNC_REMOTE_PATH/$RSYNC_EXECUTABLE" + else + RSYNC_PATH="$RSYNC_EXECUTABLE" + fi COMMAND_SUDO="" fi @@ -1711,37 +1717,39 @@ then silent=1 exec > /dev/null 2>&1 SyncOnChanges & - exit + disown + exit 0 else SyncOnChanges fi - fi - DATE=$(date) - Log "-------------------------------------------------------------" - Log "$DRY_WARNING $DATE - $PROGRAM $PROGRAM_VERSION script begin." - Log "-------------------------------------------------------------" - if [ $daemonize -eq 1 ] - then - Log "Running as daemon" - fi - Log "Sync task [$SYNC_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)" - GetOperatingSystem - if [ $no_maxtime -eq 1 ] - then - SOFT_MAX_EXEC_TIME=0 - HARD_MAX_EXEC_TIME=0 - fi - CheckMasterSlaveDirs - CheckMinimumSpace - if [ $? == 0 ] - then - RunBeforeHook - Main + else + DATE=$(date) + Log "-------------------------------------------------------------" + Log "$DRY_WARNING $DATE - $PROGRAM $PROGRAM_VERSION script begin." + Log "-------------------------------------------------------------" + if [ $daemonize -eq 1 ] + then + Log "Running as daemon" + fi + Log "Sync task [$SYNC_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)" + GetOperatingSystem + if [ $no_maxtime -eq 1 ] + then + SOFT_MAX_EXEC_TIME=0 + HARD_MAX_EXEC_TIME=0 + fi + CheckMasterSlaveDirs + CheckMinimumSpace if [ $? == 0 ] then - SoftDelete + RunBeforeHook + Main + if [ $? == 0 ] + then + SoftDelete + fi + RunAfterHook fi - RunAfterHook fi else LogError "Environment not suitable to run osync." diff --git a/sync.conf b/sync.conf index 6594dc4..22634c8 100755 --- a/sync.conf +++ b/sync.conf @@ -2,16 +2,19 @@ ###### Osync - Rsync based two way sync engine with fault tolerance ###### (L) 2013-2014 by Orsiris "Ozy" de Jong (www.netpower.fr) -#### Config file rev 1701201401 +###### Config file rev 0903201401 ## ---------- GENERAL OPTIONS ## Sync job identification SYNC_ID="sync_test" -## Directories to synchronize. Master must be on the system Osync runs on. Slave can be either on the same system, or on a remote one. +## Directories to synchronize. Master must be on the system Osync runs on. Slave can be either a local directory, or a remote one. MASTER_SYNC_DIR="/home/git/osync/test/dir1" -SLAVE_SYNC_DIR="/home/git/osync/test/dir2" +#SLAVE_SYNC_DIR="/home/git/osync/test/dir2" +SLAVE_SYNC_DIR=""ssh://user@host.com:22//path/to/dir2" +## If slave replica is a remote directory, you must specifiy a RSA key. Please see documentation for further information. +SSH_RSA_PRIVATE_KEY="~/.ssh/id_rsa" ## Create sync directories if they do not exist CREATE_DIRS=no @@ -38,13 +41,6 @@ RSYNC_EXECUTABLE=rsync ## ---------- REMOTE SYNC OPTIONS -## The following options allow Osync to sync a slave replica on a remote system via an SSH tunnel. -## Needs public RSA key need to be put into ~/.ssh/authorized_keys in remote users home directory. See documentation for remote sync. -REMOTE_SYNC=no -SSH_RSA_PRIVATE_KEY=~/.ssh/id_rsa -REMOTE_USER=syncuser -REMOTE_HOST=your-remote-host.tld -REMOTE_PORT=22 ## ssh compression should be used unless your remote connection is good enough (LAN) SSH_COMPRESSION=yes @@ -54,10 +50,10 @@ REMOTE_HOST_PING=no ## Check for internet access by pinging one or more 3rd party hosts before remote sync task. Leave empty if you don't want this check to be be performed. Failing to ping will stop sync. ## If you use this function, you should set more than one 3rd party host, and be sure you can ping them. ## Be aware some DNS like opendns redirect false hostnames. Also, this adds an extra execution time of a bit less than a minute. -REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.fr" +REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com" ## Remote rsync executable path. Leave this empty in most cases -REMOTE_RSYNC_PATH="" +RSYNC_REMOTE_PATH="" ## ---------- MISC OPTIONS @@ -73,7 +69,7 @@ RSYNC_COMPRESS=yes SOFT_MAX_EXEC_TIME=7200 HARD_MAX_EXEC_TIME=10600 -## Minimum time (in seconds) between two sync processes in file monitor or daemon mode in order to let copy operations finish +## Minimum time (in seconds) in file monitor mode between modification detection and sync task in order to let copy operations finish. MIN_WAIT=60 ## ---------- BACKUP AND TRASH OPTIONS @@ -106,7 +102,7 @@ FORCE_STRANGER_LOCK_RESUME=no ## List of alert mails separated by spaces DESTINATION_MAILS="your@alert.tld" -## Windows (MSYS environment) only mail options (used by sendemail.exe) +## Windows (MSYS environment) only mail options (used with sendemail.exe from Brandon Zehm) SENDER_MAIL="alert@your.system" SMTP_SERVER=smtp.your.isp.com SMTP_USER=