I would like to run commands from the terminal (mostly Python servers) and essentially daemonize them. I am running the MinGW terminal "Git Bash" that comes with the Windows installer for Git.
Things tried that do not work:
- nohup -> command not found
- setsid -> command not found
$ script.py &
-> does not behave as expected$ script.py & disown
-> does not behave as expected
I would use bg
, but my end-goal is to close the terminal after my servers are all running and not kill the processes.
Best Answer
This is a synthesis from my longer answer to a similar question in SO.
If your app logs to stdout/stderr, use:
If it logs to files, via sockets etc. and you do not need stdout/stderr, use:
In both cases you get a daemon like process which will survive when you close bash. In the first instance your script is hosted in a visible
cmd.exe
window.Much more here.