|
|
|
|
@ -34,10 +34,6 @@ services = [
|
|
|
|
|
'collectdmon.pid'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
services_stop = [
|
|
|
|
|
'rate-o-mat.pid',
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
watched_dirs = [
|
|
|
|
|
'/var/run/kamailio',
|
|
|
|
|
'/var/run/ngcp-sems',
|
|
|
|
|
@ -53,7 +49,7 @@ class Handler(pyinotify.ProcessEvent):
|
|
|
|
|
def check_all(self):
|
|
|
|
|
all = True
|
|
|
|
|
for k,v in self.watched.iteritems():
|
|
|
|
|
all = (all and (v['created'] or v['modified'] or v['deleted']))
|
|
|
|
|
all = (all and (v['created'] or v['modified']))
|
|
|
|
|
print "checking: %s[%s] all:%s" % (k,v, all)
|
|
|
|
|
return all
|
|
|
|
|
|
|
|
|
|
@ -73,11 +69,6 @@ class Handler(pyinotify.ProcessEvent):
|
|
|
|
|
if watched.has_key(event.pathname):
|
|
|
|
|
watched[event.pathname]['modified'] = True
|
|
|
|
|
print "modified %s" % event.pathname
|
|
|
|
|
|
|
|
|
|
def process_IN_DELETE(self, event):
|
|
|
|
|
if watched.has_key(event.pathname+'_del'):
|
|
|
|
|
watched[event.pathname+'_del']['deleted'] = True
|
|
|
|
|
print "deleted %s" % event.pathname
|
|
|
|
|
# for debug
|
|
|
|
|
# def process_default(self, event):
|
|
|
|
|
# if watched.has_key(event.pathname):
|
|
|
|
|
@ -91,13 +82,6 @@ for service in services:
|
|
|
|
|
print "Watching %s" % service_pid
|
|
|
|
|
watched[service_pid] = {'deleted': False, 'created': False, 'modified': False }
|
|
|
|
|
wm.add_watch(service_pid, pyinotify.IN_IGNORED)
|
|
|
|
|
|
|
|
|
|
for service in services_stop:
|
|
|
|
|
service_pid = os.path.join(base_path, service)
|
|
|
|
|
print "Watching %s" % service_pid
|
|
|
|
|
watched[service_pid+'_del'] = {'deleted': False, 'created': False, 'modified': False }
|
|
|
|
|
wm.add_watch(service_pid, pyinotify.IN_IGNORED)
|
|
|
|
|
|
|
|
|
|
for d in watched_dirs:
|
|
|
|
|
wm.add_watch(d, pyinotify.ALL_EVENTS)
|
|
|
|
|
|
|
|
|
|
|