Improved daemon for file monitor mode

This commit is contained in:
deajan 2013-11-18 23:50:39 +01:00
parent 5a7059f724
commit 9dfd3e32ac
1 changed files with 14 additions and 2 deletions

View File

@ -51,7 +51,13 @@ export LC_ALL=C
function Log function Log
{ {
if [ $daemonize -eq 1 ]
then
echo -e "$(date) - $1" >> "$LOG_FILE"
else
echo -e "TIME: $SECONDS - $1" >> "$LOG_FILE" echo -e "TIME: $SECONDS - $1" >> "$LOG_FILE"
fi
if [ $silent -eq 0 ] if [ $silent -eq 0 ]
then then
echo -e "TIME: $SECONDS - $1" echo -e "TIME: $SECONDS - $1"
@ -1706,7 +1712,7 @@ function SyncOnChanges
while true while true
do do
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 "$MASTER_SYNC_DIR/"
$osync_cmd "$ConfigFile" $osync_cmd "$ConfigFile" $opts
done done
} }
@ -1723,6 +1729,7 @@ else
verbose=0 verbose=0
fi fi
# Alert flags # Alert flags
opts=""
soft_alert_total=0 soft_alert_total=0
error_alert=0 error_alert=0
soft_stop=0 soft_stop=0
@ -1741,18 +1748,23 @@ do
case $i in case $i in
--dry) --dry)
dryrun=1 dryrun=1
opts=$opts" --dry"
;; ;;
--silent) --silent)
silent=1 silent=1
opts=$opts" --silent"
;; ;;
--verbose) --verbose)
verbose=1 verbose=1
opts=$opts" --verbose"
;; ;;
--force-unlock) --force-unlock)
force_unlock=1 force_unlock=1
opts=$opts" --force-unlock"
;; ;;
--no-maxtime) --no-maxtime)
no_maxtime=1 no_maxtime=1
opts=$opts" --no-maxtime"
;; ;;
--help|-h|--version|-v) --help|-h|--version|-v)
Usage Usage