<html><body><div><br></div><div><br>On May 16, 2013, at 12:34 PM, Justin Venus <justin.venus@gmail.com> wrote:<br><br><div><blockquote type="cite"><div class="msg-quote"><p dir="ltr">IMO monit is pretty easy to setup and probably your best bet. However you could get puppet, chef, or cfengine to start processes for you. If you are feeling adventurous, you could set up something like apache mesos to keep your tasks running.</p><p dir="ltr">Justin Venus</p><div class="gmail_quote">On May 16, 2013 10:27 AM, "Jonathan Vanasco" <<a href="mailto:twisted-python@2xlp.com" data-mce-href="mailto:twisted-python@2xlp.com">twisted-python@2xlp.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;">Hi,<br> <br> i'm running a twisted daemon on ubuntu<br> <br> It seems to get shut down by the system periodically. Logs show that the kernel (or something) kills it for taking up too much memory. I definitely have coding issues in there that i'm working on to address this.<br> <br> Does anyone have a suggestion for tools I can easily use on ubuntu to monitor and restart if needed ? I haven't had to do something like this in 5 years, and back then it was a hassle to get monit or supervisord working.<br> <br> thanks<br> <br> /jonathan<br> _______________________________________________<br> Twisted-Python mailing list<br> <a href="mailto:Twisted-Python@twistedmatrix.com" data-mce-href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br> <a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" data-mce-href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br></blockquote></div><div class="_stretch">_______________________________________________<br> Twisted-Python mailing list<br> <a href="mailto:Twisted-Python@twistedmatrix.com" data-mce-href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br> <a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" data-mce-href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a></div></div></blockquote><span> </span><br><br>Another simple option is to use twisted's own procmon.ProcessMonitor to launch your twistd daemon. You can use it "out of the box", or implement your own service based upon it, e.g.,<br><br><br>from twisted.python import usage<br>from twisted.runner import procmon<br><br><br><br>class Options(usage.Options):<br> synopsis = '[mymonitor options] commandline'<br><br> optParameters = (<br> (<br> 'threshold',<br> 't',<br> 1,<br> 'How many seconds a process has to run before it is considered to have died instantly.',<br> float<br> ),<br> (<br> 'killtime',<br> 'k',<br> 5,<br> 'How many seconds a process being killed has to get its affairs in order before it gets killed with an unmaskable signal.',<br> float<br> ),<br> (<br> 'minrestartdelay',<br> 'm',<br> 1,<br> 'The minimum number of seconds to wait before attempting to restart a process.',<br> float<br> ),<br> (<br> 'maxrestartdelay',<br> 'M',<br> 3600,<br> 'The maximum number of seconds to wait before attempting to restart a process.',<br> float<br> )<br> )<br><br> optFlags = ()<br><br><br> longdesc = """Blah blah blah"""<br><br> def parseArgs(self, *args):<br> """<br> Grab the command line that is going to be started and monitored<br> """<br> self['args'] = args<br><br><br> def postOptions(self):<br> """<br> Check for dependencies.<br> """<br> if len(self['args']) < 1:<br> raise usage.UsageError('Please specify a process commandline')<br><br><br>def makeService(config):<br> from twisted.internet import reactor<br><br> myMonitorService = procmon.ProcessMonitor(reactor)<br><br> myMonitorService.threshold = config['threshold']<br> myMonitorService.killTime = config['killtime']<br> myMonitorService.minRestartDelay = config['minrestartdelay']<br> myMonitorService.maxRestartDelay = config['maxrestartdelay']<br> myMonitorService.addProcess(<br> 'MyTwistedServiceThatSometimesBlowsUp',<br> config['args'],<br> uid=None,<br> gid=None,<br> env={}<br> )<br> return myMonitorService<br><br><br>Hope this helps,<br><br>Daniel<br></div></div></body></html>