X-Git-Url: https://git.kaliko.me/?p=python-daemon.git;a=blobdiff_plain;f=doc%2Fexamples%2Fdaemon-example.py;fp=doc%2Fexamples%2Fdaemon-example.py;h=bb1855b78d555e01837b83463c5cf77994b8b5a1;hp=47dff70241296913c9961d024a93bbac45743fa9;hb=fc3dd8a7aa1e23891f29960fbb0fc6aa954514f5;hpb=8fd5c69b40d3902438bf41b3f102297d52a19c1b diff --git a/doc/examples/daemon-example.py b/doc/examples/daemon-example.py index 47dff70..bb1855b 100755 --- a/doc/examples/daemon-example.py +++ b/doc/examples/daemon-example.py @@ -11,15 +11,17 @@ class MyDaemon(Daemon): def run(self): """Overrides Daemon().run() with actions you want to daemonize. MyDaemon.run() is then called within MyDaemon().start()""" - print "Starting Deamon!" + print('Starting Deamon!') # message issued on self.stdout while True: time.sleep(1) + sys.stderr.write('œ unicode write test to stderr\n') + sys.stdout.write('write test to stdout\n') def shutdown(self): """Overrides Daemon().shutdown() with some clean up""" - print "Stopping Daemon!" + print("Stopping Daemon!") # message issued on self.stdout -if __name__ == "__main__": +if __name__ == '__main__': daemon = MyDaemon('/tmp/daemon-example.pid', '/tmp/daemon.log') if len(sys.argv) == 2: @@ -30,9 +32,9 @@ if __name__ == "__main__": elif 'restart' == sys.argv[1]: daemon.restart() else: - print "Unknown command" + print('Unknown command') sys.exit(2) sys.exit(0) else: - print "usage: %s start|stop|restart" % sys.argv[0] + print("usage: {} start|stop|restart".format(sys.argv[0])) sys.exit(2)