]> git.llucax.com Git - software/pymin.git/commitdiff
Se corrigen el nombre del pid file y se camban prints por calls.
authorFede <fedux@linux-kt9u.site>
Sun, 21 Oct 2007 21:46:34 +0000 (18:46 -0300)
committerFede <fedux@linux-kt9u.site>
Sun, 21 Oct 2007 21:56:51 +0000 (18:56 -0300)
pymin/services/vrrp/__init__.py

index 393f90c23ef7825e506942ec2bbf361f9ab7c6f2..580d4e69a23ec42540e65b6b1345601c3fa76770 100644 (file)
@@ -9,8 +9,6 @@ from pymin.services.util import Restorable, TransactionalHandler, ParametersHand
 
 __ALL__ = ('VrrpHandler',)
 
 
 __ALL__ = ('VrrpHandler',)
 
-pid_filename = 'vrrp.pid'
-
 class VrrpHandler(Restorable, ParametersHandler, TransactionalHandler):
     handler_help = u"Manage VRRP service"
 
 class VrrpHandler(Restorable, ParametersHandler, TransactionalHandler):
     handler_help = u"Manage VRRP service"
 
@@ -32,18 +30,19 @@ class VrrpHandler(Restorable, ParametersHandler, TransactionalHandler):
     @handler('Starts the service')
     def start(self):
         if self.params['prio'] != '':
     @handler('Starts the service')
     def start(self):
         if self.params['prio'] != '':
-            #call(('vrrp','-i',self.params[dev],'-v',self.params[id],'-p',self.params[prio],self.params[ipaddress]))
-            print ('vrrp','-i',self.params['dev'],'-v',self.params['id'],'-p',self.params['prio'],self.params['ipaddress'])
+            call(('/usr/local/bin/vrrpd','-i',self.params['dev'],'-v',self.params['id'],'-p',self.params['prio'],self.params['ipaddress']))
+            #print ('vrrpd','-i',self.params['dev'],'-v',self.params['id'],'-p',self.params['prio'],self.params['ipaddress'])
         else:
         else:
-            #call(('vrrp','-i',self.params[dev],'-v',self.params[id],self.params[ipaddress]))
-            print ('vrrp','-i',self.params['dev'],'-v',self.params['id'],self.params['ipaddress'])
+            call(('/usr/local/bin/vrrpd','-i',self.params['dev'],'-v',self.params['id'],self.params['ipaddress']))
+            #print ('vrrpd','-i',self.params['dev'],'-v',self.params['id'],self.params['ipaddress'])
 
     @handler('Stop the service')
     def stop(self):
         try :
 
     @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()))
+            pid = 'vrrpd' + '_' + self.params['dev'] + '_' + self.params['id'] + '.pid'
+            f = file(path.join(self._pid_dir, pid ), 'r')
+            call(('kill',f.read().strip('\n')))
+            #print('kill','<',f.read())
         except IOError:
             pass
 
         except IOError:
             pass
 
@@ -56,4 +55,4 @@ class VrrpHandler(Restorable, ParametersHandler, TransactionalHandler):
 if __name__ == '__main__':
     v = VrrpHandler()
     v.set('prio','10')
 if __name__ == '__main__':
     v = VrrpHandler()
     v.set('prio','10')
-    v.commit()
\ No newline at end of file
+    v.commit()