Merge 8bc5b5ee68 into b531479414
				
					
				
			This commit is contained in:
		
						commit
						38f28e4d29
					
				
							
								
								
									
										21
									
								
								osync.sh
								
								
								
								
							
							
						
						
									
										21
									
								
								osync.sh
								
								
								
								
							| 
						 | 
					@ -1980,9 +1980,9 @@ function SyncOnChanges
 | 
				
			||||||
	do
 | 
						do
 | 
				
			||||||
		if [ "$ConfigFile" != "" ]
 | 
							if [ "$ConfigFile" != "" ]
 | 
				
			||||||
		then
 | 
							then
 | 
				
			||||||
        		cmd="bash $osync_cmd \"$ConfigFile\" $opts --no-locks"
 | 
								cmd="bash $osync_cmd \"$ConfigFile\" $opts"
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			cmd="bash $osync_cmd $opts --no-locks"
 | 
								cmd="bash $osync_cmd $opts"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		eval $cmd
 | 
							eval $cmd
 | 
				
			||||||
		retval=$?
 | 
							retval=$?
 | 
				
			||||||
| 
						 | 
					@ -1993,11 +1993,21 @@ function SyncOnChanges
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Log "#### Monitoring now."
 | 
							Log "#### Monitoring now."
 | 
				
			||||||
        	inotifywait --exclude $OSYNC_DIR $RSYNC_EXCLUDE -qq -r -e create -e modify -e delete -e move -e attrib "$MASTER_SYNC_DIR" &
 | 
							inotifywait --exclude $OSYNC_DIR $RSYNC_EXCLUDE -qq -r -e create -e modify -e delete -e move -e attrib --timeout "$MAX_WAIT" "$MASTER_SYNC_DIR" &
 | 
				
			||||||
		sub_pid=$!
 | 
							sub_pid=$!
 | 
				
			||||||
		wait $sub_pid
 | 
							wait $sub_pid
 | 
				
			||||||
		Log "#### Changes detected, waiting $MIN_WAIT seconds before running next sync."
 | 
							retval=$?
 | 
				
			||||||
		sleep $MIN_WAIT
 | 
							if [ $retval == 0 ]
 | 
				
			||||||
 | 
							then
 | 
				
			||||||
 | 
								Log "#### Changes detected, waiting $MIN_WAIT seconds before running next sync."
 | 
				
			||||||
 | 
								sleep $MIN_WAIT
 | 
				
			||||||
 | 
							elif [ $retval == 2 ]
 | 
				
			||||||
 | 
							then
 | 
				
			||||||
 | 
								Log "#### $MAX_WAIT timeout reached, running sync."
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								Log "#### inotify error detected, waiting $MIN_WAIT seconds before running next sync."
 | 
				
			||||||
 | 
								sleep $MIN_WAIT
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -2086,6 +2096,7 @@ do
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
		--on-changes)
 | 
							--on-changes)
 | 
				
			||||||
		sync_on_changes=1
 | 
							sync_on_changes=1
 | 
				
			||||||
 | 
							nolocks=1
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
		--no-locks)
 | 
							--no-locks)
 | 
				
			||||||
		nolocks=1
 | 
							nolocks=1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,6 +87,10 @@ HARD_MAX_EXEC_TIME=10600
 | 
				
			||||||
## Minimum time (in seconds) in file monitor /daemon mode between modification detection and sync task in order to let copy operations finish.
 | 
					## Minimum time (in seconds) in file monitor /daemon mode between modification detection and sync task in order to let copy operations finish.
 | 
				
			||||||
MIN_WAIT=60
 | 
					MIN_WAIT=60
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Maximum time (in seconds) waiting in file monitor / daemon mode. After this time, sync is run.
 | 
				
			||||||
 | 
					## Use 0 to wait indefinitely.
 | 
				
			||||||
 | 
					MAX_WAIT=300
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## ---------- BACKUP AND DELETION OPTIONS
 | 
					## ---------- BACKUP AND DELETION OPTIONS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Enabling this option will keep a backup of a file on the target replica if it gets updated from the source replica. Backups will be made to .osync_workdir/backups
 | 
					## Enabling this option will keep a backup of a file on the target replica if it gets updated from the source replica. Backups will be made to .osync_workdir/backups
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue