shell里面启动的话 python main.py >> main.log 2>&1 &
如果是子进程那么,在子进程开启地方:
sys.stdout = open("/home/Ruby/nodes.out", "a", buffering=0)sys.stderr = open("/home/Ruby/nodes.out", "a", buffering=0)