add daemonising code
authorCameron Patrick <[email protected]>
Sun, 1 Aug 2004 07:20:56 +0000 (07:20 +0000)
committerCameron Patrick <[email protected]>
Sun, 1 Aug 2004 07:20:56 +0000 (07:20 +0000)
sql-edition/servers/VendServer.py

index 974e0b4..3c3aee6 100755 (executable)
@@ -434,6 +434,15 @@ def do_vend_server():
        options = parse_args()
        config_opts = VendConfigFile(options.config_file, config_options)
 
+       if options.daemon:
+               dev_null = file('/dev/null')
+               fd = dev_null.fileno()
+               os.dup2(fd, 0)
+               os.dup2(fd, 1)
+               os.dup2(fd, 2)
+               if os.fork() != 0:
+                       sys.exit(0)
+
        while True:
                try:
                        rfh, wfh = connect_to_vend(options, config_opts)

UCC git Repository :: git.ucc.asn.au