[Twisted-Python] Creating a daemon from my application

gary clark burslem2001 at yahoo.com
Mon Mar 15 11:16:08 EDT 2010


Hello,

I want to create a twisted daemon from my application:

if __name__ == '__main__':
    import nfdprocess, sys
    log.startLogging(sys.stdout)
    serverContext = ServerContextFactory()
    serverContext.protocol = nfdprocess.HandlePacket
    port =int(sys.argv[1])
    checkT = checkTables()
    checkT.resetTablesToOffline()
    outgoingTable = LoopingCall(checkT.checkOutgoingMessageQueue,serverContext)
    incomingTable = LoopingCall(checkT.checkIncomingMessageQueue,serverContext)
    checkStates=  LoopingCall(checkT.checkConnectionStates,serverContext)
    outgoingTable.start(0.5)
    incomingTable.start(1)
    checkStates.start(1)
    reactor.listenSSL(port, serverContext, serverContext)
    reactor.run()

Currently I have a class called nfdmessenger.

I am running the object.

> python nfdmessenger.py 2000

However I would run it as a deamon. Not sure how to do this? Can somebody be so kind and offer some pointers on this?

Much appreciated,
Garyc






More information about the Twisted-Python mailing list