MT#7533 stop rate-o-mat service

pid_wached.py: add services that should to stop too
mr3.5
Victor Seva 12 years ago
parent e972c3c70a
commit 6a327ad7f1

@ -95,6 +95,7 @@ else
$yaml->[0]->{kamailio}{proxy}{presence}{enable} = 'yes';
$yaml->[0]->{sems}{debug} = 'yes';
$yaml->[0]->{checktools}{sip_check_enable} = 0;
$yaml->[0]->{rateomat}{enable} = 'no';
tie @array, 'Tie::File', '/etc/hosts' or die ('Can set test domain on /etc/hosts');
for (@array)

@ -34,6 +34,10 @@ services = [
'collectdmon.pid'
]
services_stop = [
'rate-o-mat.pid',
]
watched_dirs = [
'/var/run/kamailio',
'/var/run/ngcp-sems',
@ -49,7 +53,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']))
all = (all and (v['created'] or v['modified'] or v['deleted']))
print "checking: %s[%s] all:%s" % (k,v, all)
return all
@ -69,6 +73,11 @@ 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):
@ -82,6 +91,13 @@ 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)

Loading…
Cancel
Save