#!/usr/bin/env python import logging import logging.handlers import sys import socket from xmlrpclib import * def main(): sysloger = logging.getLogger('sysloger') # logging levels = CRITICAL << ERROR << WARNING << INFO << DEBUG << NOTSET sysloger.setLevel(logging.WARNING) sysloger.addHandler(logging.handlers.SysLogHandler(address='/dev/log')) sysloger.info('[lliurex-signoflife] : Database /var/lib/lliurex-listener/userlogged exist') s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect(("server",4242)) except: sysloger.error('[lliurex-signoflife] : not connect with server on port 80') sys.exit(0) serverip = s.getpeername()[0] myip = s.getsockname()[0] server = ServerProxy ("http://"+serverip+":4242") sysloger.debug("[lliurex-signoflife] : Send sign of life with ip " + myip + " to " +serverip) server.machineSignLife(myip) if __name__ == '__main__': main()