time.sleep(5) #self.cleanup() def stop(self, *args, **kwargs): print "Stopping via stop()" self.running = False if __name__ == '__main__': instance = myapp() if (len(sys.argv) < 2): print "Use 'start', 'stop' or 'status' as argument" sys.exit(1) pid = burrdaemon.readPidFile(instance.pidfile_path) if (sys.argv[1] == 'status'): if pid: msg = "Running as PID %d" % pid print msg sys.exit(0) else: msg = "Not running" print msg sys.exit(1) if (sys.argv[1] == 'start'): if pid: print "Running as PID %d" % pid
if (len(sys.argv) < 2): print "Use 'start', 'stop' or 'status' as argument" sys.exit(1) silent = False try: if sys.argv[2] == 'silent': silent = True except Exception as e: pass #syslog.syslog('Called with %s' % sys.argv[1]) #print 'Called with %s' % sys.argv[1] pid = burrdaemon.readPidFile(instance.pidfile_path) if (sys.argv[1] == 'status'): if pid: if not silent: msg = "Running as PID %d" % pid print msg sys.exit(0) else: if not silent: msg = "Not running" print msg sys.exit(1) if (sys.argv[1] == 'start'): # If previous run is being stopped wait for it to complete
time.sleep(5) #self.cleanup() def stop(self, *args, **kwargs): print "Stopping via stop()" self.running = False if __name__ == '__main__': instance = myapp() if (len(sys.argv) < 2): print "Use 'start', 'stop' or 'status' as argument" sys.exit(1) pid = burrdaemon.readPidFile(instance.pidfile_path) if (sys.argv[1] == 'status'): if pid: msg = "Running as PID %d" % pid print msg sys.exit(0) else: msg = "Not running" print msg sys.exit(1) if (sys.argv[1] == 'start'): if pid: print "Running as PID %d" % pid sys.exit(1)
instance = timelapse_service() if (len(sys.argv) < 2): print "Use 'start', 'stop' or 'status' as argument" sys.exit(1) silent = False try: if sys.argv[2] == 'silent': silent = True except Exception as e: pass #syslog.syslog('Called with %s' % sys.argv[1]) #print 'Called with %s' % sys.argv[1] pid = burrdaemon.readPidFile(instance.pidfile_path) if (sys.argv[1] == 'status'): if pid: if not silent: msg = "Running as PID %d" % pid print msg sys.exit(0) else: if not silent: msg = "Not running" print msg sys.exit(1) if (sys.argv[1] == 'start'): # If previous run is being stopped wait for it to complete