From c43149e967896d18caaaf373ed7f75b4e98fed35 Mon Sep 17 00:00:00 2001 From: Cameron Patrick Date: Sun, 1 Aug 2004 07:20:56 +0000 Subject: [PATCH 1/1] add daemonising code --- sql-edition/servers/VendServer.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index 974e0b4..3c3aee6 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -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) -- 2.20.1