I remember there was some kind of team

python script.py & [что-то там] 

which ran the script and it was possible to close the terminal, leave the server, and the script continued to work. Can anyone remind?

  • one
    Maybe something like this: nohup python script.py> /var/log/myscript.log 2> & 1 & nohup ... - unbinds the I / O ...> ... - redirects the output to a file ... 2 > & 1 - the error stream redirects to the output stream ... & - launch in the background - BOPOH
  • @BOPOH, yes, this is it. thank. - fogipoziw

1 answer 1

simply

 python script.py & 

will run the script in the background. To "return" it, you need a command

 fg %1 

But for the server it is better to use screen so that you can connect to the process if necessary.

PS If the script is already running, then you can stop it (do not finish, but “pause” with ctrl + z) and continue execution in the background with the command

 bg %1