Unfortunately ran into an upstream bug with rb-inotify when developing this. Here is the issue and one line fix: http://github.com/nex3/rb-inotify/issues#issue/5 --- src/dbomatic/dbomatic.rb | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/dbomatic/dbomatic.rb b/src/dbomatic/dbomatic.rb index 154d766..3e7b342 100644 --- a/src/dbomatic/dbomatic.rb +++ b/src/dbomatic/dbomatic.rb @@ -60,6 +60,7 @@ end CONDOR_EVENT_LOG_FILE = "#{condor_event_log_dir}/EventLog" EVENT_LOG_POS_FILE = "#{dbomatic_run_dir}/event_log_position" + # Handle the event log's xml class CondorEventLog < Nokogiri::XML::SAX::Document attr_accessor :tag, :event_type, :event_cmd, :event_time @@ -147,7 +148,18 @@ else } end -notifier.run +# Gracefully exit when killed or interrupted +shutdown_handler = lambda { + puts "Terminating..." + notifier.stop + parser << "</events>" + parser.finish +} +Signal.trap("TERM", shutdown_handler) +Signal.trap("INT", shutdown_handler) -parser << "</events>" -parser.finish +begin + notifier.run +# notifier will raise SystemCallError when interrupted +rescue SystemCallError => e +end -- 1.7.2.1 _______________________________________________ deltacloud-devel mailing list deltacloud-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/deltacloud-devel