many thx to matty_dubs for sticking around and helping debug this
---
src/dbomatic/dbomatic | 40 ++++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/src/dbomatic/dbomatic b/src/dbomatic/dbomatic
index 1cd1229..d2fd0b4 100755
--- a/src/dbomatic/dbomatic
+++ b/src/dbomatic/dbomatic
@@ -286,21 +286,37 @@ begin
notifier.watch(CONDOR_EVENT_LOG_FILE, :modify){ |event|
parse_log_file log_file, parser
}
+ # adjust parser if log file has been truncated
+ notifier.watch(CONDOR_EVENT_LOG_FILE, :close_write){ |event|
+ s = File.size(CONDOR_EVENT_LOG_FILE)
+ log_file.pos = s if log_file.pos < s
+ }
+ end
- # if log file doesn't exist wait until it does
- else
- notifier.watch(condor_event_log_dir, :create){ |event|
- if event.name == "EventLog"
- log_file = File.open(CONDOR_EVENT_LOG_FILE)
+ # if log file doesn't exist wait until it does
+ notifier.watch(condor_event_log_dir, :create, :moved_to){ |event|
+ if event.name == "EventLog"
+ log_file = File.open(CONDOR_EVENT_LOG_FILE)
+ parse_log_file log_file, parser
+
+ # Setup inotify watch for condor event log
+ notifier.watch(CONDOR_EVENT_LOG_FILE, :modify){ |event|
parse_log_file log_file, parser
+ }
+ # adjust parser if log file has been truncated
+ notifier.watch(CONDOR_EVENT_LOG_FILE, :close_write){ |event|
+ s = File.size(CONDOR_EVENT_LOG_FILE)
+ log_file.pos = s if log_file.pos < s
+ }
+ end
+ }
- # Setup inotify watch for condor event log
- notifier.watch(CONDOR_EVENT_LOG_FILE, :modify){ |event|
- parse_log_file log_file, parser
- }
- end
- }
- end
+ notifier.watch(condor_event_log_dir, :delete, :moved_from){ |event|
+ if event.name == "EventLog"
+ log_file.close
+ File.open(EVENT_LOG_POS_FILE, 'w') { |f| f.write "0" }
+ end
+ }
while true
begin
--
1.7.2.3
Show replies by date