DEBUG = True
+
def recv_pickled_data(clientsock):
# while chunk:
# chunk = clientsock.recv(BUFFER_SIZE)
# recv_pickled_data(clientsock)
clientsock.close()
+
class MyDaemon(Daemon):
- def run(self, ip, port):
- doServer(ip, port)
+ def run(self, ip, port):
+ doServer(ip, port)
if __name__ == "__main__":
+
if len(sys.argv) == 4:
daemon = MyDaemon('/tmp/daemon-example.pid', sys.argv[2], int(sys.argv[3]))
- if 'start' == sys.argv[1]:
- daemon.start()
- elif 'stop' == sys.argv[1]:
- daemon.stop()
- elif 'restart' == sys.argv[1]:
- daemon.restart()
- else:
- print "Unknown command"
- sys.exit(2)
- sys.exit(0)
- else:
- print "usage: %s start|stop|restart <host_ip> <port>" % sys.argv[0]
- sys.exit(2)
+ if 'start' == sys.argv[1]:
+ daemon.start()
+ elif 'stop' == sys.argv[1]:
+ daemon.stop()
+ elif 'restart' == sys.argv[1]:
+ daemon.restart()
+ else:
+ print "Unknown command"
+ sys.exit(2)
+ sys.exit(0)
+ else:
+ print "usage: %s start|stop|restart <host_ip> <port>" % sys.argv[0]
+ sys.exit(2)