1
0

move start_daemon code to main script

This commit is contained in:
ThomasV
2014-03-11 08:33:58 +01:00
parent e6bbf22003
commit 489413d358
3 changed files with 31 additions and 37 deletions

View File

@@ -295,28 +295,6 @@ class NetworkServer:
def start_daemon(config):
pid = os.fork()
if (pid == 0): # The first child.
os.chdir("/")
os.setsid()
os.umask(0)
pid2 = os.fork()
if (pid2 == 0): # Second child
server = NetworkServer(config)
try:
server.main_loop()
except KeyboardInterrupt:
print "Ctrl C - Stopping server"
sys.exit(1)
sys.exit(0)
# should use a signal
time.sleep(2)
if __name__ == '__main__':
import simple_config
config = simple_config.SimpleConfig({'verbose':True, 'server':'ecdsa.net:50002:s'})