Screen for running long-time script in terminal
- By Preneesh AV --
- 08-Oct-2019 --
- 168 Comments
If you are using terminal(ssh or something) and you want to keep a long-time script working after you log out from the terminal, you can try this:
screen
apt-get install screen
create a virtual terminal inside( namely abc): screen -dmS abc
now we connect to abc: screen -r abc
So, now we can run python script: python Keep_sending_mail.py
from now on, you can directly close your terminal, however, the python script will keep running rather than being shut down
Since this
Keep_sending_mail.py
's PID belong to the virtual screen rather than the terminal(ssh)
If you want to go back check your script running status, you can use screen -r abc
again