Fixing ping/pong between initiator and targets

This commit is contained in:
deajan 2018-10-10 20:57:48 +02:00
parent 1b8f2ea7fc
commit c963d71ecd
1 changed files with 6 additions and 7 deletions

View File

@ -2782,26 +2782,25 @@ function SyncOnChanges {
fi fi
#WIP Watch cmd log is debug and not notice
Logger "#### Monitoring now." "NOTICE" Logger "#### Monitoring now." "NOTICE"
# inotifywait < 3.20 can't handle multiple --exclude statements. For compat issues, we'll watch everything except .osync_workdir
if [ "$LOCAL_OS" == "MacOSX" ]; then if [ "$LOCAL_OS" == "MacOSX" ]; then
watchCmd="fswatch --exclude \"$OSYNC_DIR\" -1 \"$watchDirectory\" > /dev/null &" watchCmd="fswatch --exclude \"$OSYNC_DIR\" -1 \"$watchDirectory\" > /dev/null &"
# Mac fswatch doesn't have timeout switch, replacing wait $! with WaitForTaskCompletion without warning nor spinner and increased SLEEP_TIME to avoid cpu hogging. This simulates wait $! with timeout # Mac fswatch doesn't have timeout switch, replacing wait $! with WaitForTaskCompletion without warning nor spinner and increased SLEEP_TIME to avoid cpu hogging. This simulates wait $! with timeout
Logger "Watch cmd M: [$watchCmd]." "NOTICE" Logger "Watch cmd M: [$watchCmd]." "DEBUG"
eval "$watchCmd" eval "$watchCmd"
ExecTasks $! "MonitorMacOSXWait" false 0 0 0 $MAX_WAIT true 1 0 ExecTasks $! "MonitorMacOSXWait" false 0 0 0 $MAX_WAIT true 1 0
elif [ "$LOCAL_OS" == "BSD" ]; then elif [ "$LOCAL_OS" == "BSD" ]; then
# BSD version of inotifywait does not support multiple --exclude statements # BSD version of inotifywait does not support multiple --exclude statements
watchCmd="inotifywait --exclude \"$OSYNC_DIR\" -qq -r -e create -e modify -e delete -e move -e attrib --timeout \"$MAX_WAIT\" \"$watchDirectory\" &" watchCmd="inotifywait --exclude \"$OSYNC_DIR\" -qq -r -e create -e modify -e delete -e move -e attrib --timeout \"$MAX_WAIT\" \"$watchDirectory\" &"
Logger "Watch cmd B: [$watchCmd]." "NOTICE" Logger "Watch cmd B: [$watchCmd]." "DEBUG"
eval "$watchCmd" eval "$watchCmd"
wait $! wait $!
else else
#WIP: replaced exclude $OSYNC_DIR with $watchDirectory/$OSYNC_DIR
Logger "--$RSYNC_PATTERNS--" "NOTICE"
watchCmd="inotifywait --exclude \"$OSYNC_DIR\" -qq -r -e create -e modify -e delete -e move -e attrib --timeout \"$MAX_WAIT\" \"$watchDirectory\" &" watchCmd="inotifywait --exclude \"$OSYNC_DIR\" -qq -r -e create -e modify -e delete -e move -e attrib --timeout \"$MAX_WAIT\" \"$watchDirectory\" &"
Logger "Watch cmd L: [$watchCmd]." "NOTICE" Logger "Watch cmd L: [$watchCmd]." "DEBUG"
eval "$watchCmd" eval "$watchCmd"
wait $! wait $!
fi fi