- @handler('Stop the service')
- def stop(self):
- try :
- f = file(path.join(self._pid_dir, pid_filename ), 'r')
- #call(('kill','<',f.read()))
- print(('kill','<',f.read()))
- except IOError:
- pass
+ def _service_stop(self):
+ log.debug(u'VrrpHandler._service_stop()')
+ try:
+ pid_filename = 'vrrpd_%(dev)s_%(id)s.pid' % self.params
+ log.debug(u'VrrpHandler._service_stop: getting pid from %r',
+ pid_filename)
+ pid = file(path.join(self._pid_dir, pid_filename )).read()
+ pid = int(pid.strip())
+ log.debug(u'VrrpHandler._service_stop: killing pid %r', pid)
+ os.kill(pid, SIGTERM)
+ except (IOError, OSError), e:
+ log.debug(u'VrrpHandler._service_stop: error %r', e)