Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running python script in background with nohup and timing it

I'm running a python script on a remote server with the time command as follows:

time python myscript.py

SSH timeout occurs on the server after some time, so i also need to run it with nohup.So, i have the following two questions:

  1. Is nohup time myscript.py & the right command to execute my python script ?
  2. If the script runs in the background, how will i see the output of the time command ?

Please Help Thank You

like image 761
Jim Avatar asked May 25 '26 02:05

Jim


1 Answers

nohup will usually write STDOUT and STDERR to a file called "nohup.out" in the current directory. You'll be able to see the output of time at the end of that file.

Another way of solving this redirection of the output like this:

nohup time bla.py >myoutput &
like image 100
zakx Avatar answered May 27 '26 06:05

zakx