Some minor fixes

pull/3/head
deajan 10 years ago
parent 922560212b
commit 223efdb78a

@ -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 - Tree functions execute piped commands (grep, awk) on local system when launched on remote slave which can cause more bandwith usage
- SysV init script for RHEL / CentOS
FAR FUTURE IMPROVEMENTS FAR FUTURE IMPROVEMENTS
----------------------- -----------------------
- Rethink of .osync_workdir/state/* files with PIDs, Host and Task Names to better identify multiple instances on the same fileset - MultiMaster support
- Improve Master / Slave schema to Multimaster schema - Rethink of .osync_workdir/state/* files with PIDs, Host and Task Names to better identify multiple instances on the same fileset
- State files should exist per replica for Multimaster schema - Improve Master / Slave schema to Multimaster schema
- State files should exist per replica for Multimaster schema
KNOWN ISSUES 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 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 - 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 - 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) - 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)

@ -4,7 +4,7 @@ PROGRAM="Osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong" AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=0.99preRC3 PROGRAM_VERSION=0.99preRC3
PROGRAM_BUILD=1901201409 PROGRAM_BUILD=0903201401
DEBUG=no DEBUG=no
SCRIPT_PID=$$ SCRIPT_PID=$$
@ -74,7 +74,8 @@ function LogDebug
fi fi
} }
function TrapError { function TrapError
{
local JOB="$0" local JOB="$0"
local LINE="$1" local LINE="$1"
local CODE="${2:-1}" local CODE="${2:-1}"
@ -84,6 +85,11 @@ function TrapError {
fi fi
} }
function TrapUsr1
{
echo "Still doing stuff"
}
function TrapStop function TrapStop
{ {
if [ $soft_stop -eq 0 ] if [ $soft_stop -eq 0 ]
@ -1466,18 +1472,18 @@ function Init
then then
if [ "$RSYNC_REMOTE_PATH" != "" ] if [ "$RSYNC_REMOTE_PATH" != "" ]
then then
RSYNC_PATH="sudo $(type -p $RSYNC_REMOTE_PATH)/$RSYNC_EXECUTABLE)" RSYNC_PATH="sudo $RSYNC_REMOTE_PATH/$RSYNC_EXECUTABLE"
else else
RSYNC_PATH="sudo $RSYNC_EXECUTABLE" RSYNC_PATH="sudo $RSYNC_EXECUTABLE"
fi fi
COMMAND_SUDO="sudo" COMMAND_SUDO="sudo"
else else
if [ "$RSYNC_REMOTE_PATH" != "" ] if [ "$RSYNC_REMOTE_PATH" != "" ]
then then
RSYNC_PATH="$(type -p $RSYNC_REMOTE_PATH)/$RSYNC_EXECUTABLE)" RSYNC_PATH="$RSYNC_REMOTE_PATH/$RSYNC_EXECUTABLE"
else else
RSYNC_PATH="$RSYNC_EXECUTABLE" RSYNC_PATH="$RSYNC_EXECUTABLE"
fi fi
COMMAND_SUDO="" COMMAND_SUDO=""
fi fi
@ -1711,37 +1717,39 @@ then
silent=1 silent=1
exec > /dev/null 2>&1 exec > /dev/null 2>&1
SyncOnChanges & SyncOnChanges &
exit disown
exit 0
else else
SyncOnChanges SyncOnChanges
fi fi
fi else
DATE=$(date) DATE=$(date)
Log "-------------------------------------------------------------" Log "-------------------------------------------------------------"
Log "$DRY_WARNING $DATE - $PROGRAM $PROGRAM_VERSION script begin." Log "$DRY_WARNING $DATE - $PROGRAM $PROGRAM_VERSION script begin."
Log "-------------------------------------------------------------" Log "-------------------------------------------------------------"
if [ $daemonize -eq 1 ] if [ $daemonize -eq 1 ]
then then
Log "Running as daemon" Log "Running as daemon"
fi fi
Log "Sync task [$SYNC_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)" Log "Sync task [$SYNC_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)"
GetOperatingSystem GetOperatingSystem
if [ $no_maxtime -eq 1 ] if [ $no_maxtime -eq 1 ]
then then
SOFT_MAX_EXEC_TIME=0 SOFT_MAX_EXEC_TIME=0
HARD_MAX_EXEC_TIME=0 HARD_MAX_EXEC_TIME=0
fi fi
CheckMasterSlaveDirs CheckMasterSlaveDirs
CheckMinimumSpace CheckMinimumSpace
if [ $? == 0 ]
then
RunBeforeHook
Main
if [ $? == 0 ] if [ $? == 0 ]
then then
SoftDelete RunBeforeHook
Main
if [ $? == 0 ]
then
SoftDelete
fi
RunAfterHook
fi fi
RunAfterHook
fi fi
else else
LogError "Environment not suitable to run osync." LogError "Environment not suitable to run osync."

@ -2,16 +2,19 @@
###### Osync - Rsync based two way sync engine with fault tolerance ###### Osync - Rsync based two way sync engine with fault tolerance
###### (L) 2013-2014 by Orsiris "Ozy" de Jong (www.netpower.fr) ###### (L) 2013-2014 by Orsiris "Ozy" de Jong (www.netpower.fr)
#### Config file rev 1701201401 ###### Config file rev 0903201401
## ---------- GENERAL OPTIONS ## ---------- GENERAL OPTIONS
## Sync job identification ## Sync job identification
SYNC_ID="sync_test" 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" 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 sync directories if they do not exist
CREATE_DIRS=no CREATE_DIRS=no
@ -38,13 +41,6 @@ RSYNC_EXECUTABLE=rsync
## ---------- REMOTE SYNC OPTIONS ## ---------- 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 should be used unless your remote connection is good enough (LAN)
SSH_COMPRESSION=yes 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. ## 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. ## 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. ## 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 executable path. Leave this empty in most cases
REMOTE_RSYNC_PATH="" RSYNC_REMOTE_PATH=""
## ---------- MISC OPTIONS ## ---------- MISC OPTIONS
@ -73,7 +69,7 @@ RSYNC_COMPRESS=yes
SOFT_MAX_EXEC_TIME=7200 SOFT_MAX_EXEC_TIME=7200
HARD_MAX_EXEC_TIME=10600 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 MIN_WAIT=60
## ---------- BACKUP AND TRASH OPTIONS ## ---------- BACKUP AND TRASH OPTIONS
@ -106,7 +102,7 @@ FORCE_STRANGER_LOCK_RESUME=no
## List of alert mails separated by spaces ## List of alert mails separated by spaces
DESTINATION_MAILS="your@alert.tld" 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" SENDER_MAIL="alert@your.system"
SMTP_SERVER=smtp.your.isp.com SMTP_SERVER=smtp.your.isp.com
SMTP_USER= SMTP_USER=

Loading…
Cancel
Save