问题
I use web.py to process incoming data by "GET" and "POST" method and uses
app.run()
. This looks will run in loop and never stop.I also have a background job which detect port "9xxx" and process the incoming data, send msg to other servers to push msg to phone. I also uses a while(true) loop to do this.
How to integrate (2) into (1)? I'm confused.
I used to plan run (1) and (2) independently but there has data exchange so not convenience to code. how do you web.py
users do these similar things?
回答1:
I think this is what you want:
nohup python web.py > web.log 2>&1 &
Check out nohup wiki and man page
In production ,I'd like combine web.py with uwsgi and nginx.You can read this and have a try.And then I use supervisord to restarts server after they terminate.
来源:https://stackoverflow.com/questions/41544274/how-to-run-background-job-in-web-py