Jim
Jim

Reputation: 31

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

Upvotes: 3

Views: 9988

Answers (2)

zakx
zakx

Reputation: 681

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 &

Upvotes: 2

Jacob
Jacob

Reputation: 43219

To 1.: Yes

To 2.: You can redirect the output to a file

nohup time myscript.py > ~/time_output & 

Upvotes: 1

Related Questions