file_monitoring 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/file_monitoring
CHANGED
@@ -43,11 +43,11 @@ if ARGV.length > 1
|
|
43
43
|
conf_file_path = File.expand_path(ARGV[1])
|
44
44
|
end
|
45
45
|
|
46
|
-
Log.
|
46
|
+
Log.debug1('Taking config from:' + conf_file_path)
|
47
47
|
YAML::load_file(conf_file_path) rescue abort("Can't load %s" % conf_file_path)
|
48
48
|
pid_dir = File.expand_path('~/.bbfs/run/')
|
49
49
|
FileUtils.mkdir_p(pid_dir)
|
50
|
-
Log.
|
50
|
+
Log.debug1('pid dir:' + pid_dir)
|
51
51
|
|
52
52
|
Daemons.run_proc(
|
53
53
|
'file_monitoring', # name of daemon
|
@@ -37,13 +37,13 @@ module FileMonitoring
|
|
37
37
|
priority = (Time.now + elem['scan_period']).to_i
|
38
38
|
dir_stat = DirStat.new(File.expand_path(elem['path']), elem['stable_state'])
|
39
39
|
dir_stat.set_event_queue(@event_queue) if @event_queue
|
40
|
-
Log.
|
40
|
+
Log.debug1 "File monitoring started for: #{elem}"
|
41
41
|
pq.push([priority, elem, dir_stat], -priority)
|
42
42
|
}
|
43
43
|
|
44
44
|
log_path = Params['default_monitoring_log_path']
|
45
45
|
|
46
|
-
Log.
|
46
|
+
Log.debug1 'File monitoring log: ' + log_path
|
47
47
|
log_dir = File.dirname(log_path)
|
48
48
|
FileUtils.mkdir_p(log_dir) unless File.exists?(log_dir)
|
49
49
|
log = File.open(log_path, 'w')
|
@@ -109,7 +109,7 @@ module FileMonitoring
|
|
109
109
|
@@log.flush #Ruby1.9.3: note that this is Ruby internal buffering only; the OS may buffer the data as well
|
110
110
|
end
|
111
111
|
if (!@event_queue.nil?)
|
112
|
-
Log.
|
112
|
+
Log.debug1 "Writing to event queue [#{self.state}, #{self.path}]"
|
113
113
|
@event_queue.push([self.state, self.instance_of?(DirStat), self.path])
|
114
114
|
end
|
115
115
|
end
|