be able to reboot the DEC server when it dies
[uccvend-vendserver.git] / sql-edition / servers / VendServer.py
index a2cdfba..ff17122 100755 (executable)
@@ -400,6 +400,11 @@ if __name__ == '__main__':
 
        ServiceName = cp.get('VendingMachine', 'ServiceName')
        ServicePassword = cp.get('VendingMachine', 'Password')
-       
-       rfh, wfh = connect_to_vend(options, DBServer, DBName, DBUser, DBPassword, ServiceName, ServicePassword)
-       run_forever(rfh, wfh)
+
+       while True:
+               rfh, wfh = connect_to_vend(options, DBServer, DBName, DBUser, DBPassword, ServiceName, ServicePassword)
+               try:
+                       run_forever(rfh, wfh)
+               except VendingException:
+                       print "Connection died, trying again..."
+

UCC git Repository :: git.ucc.asn.au