开发者

Running python script in background with nohup and timing it

开发者 https://www.devze.com 2023-03-22 12:17 出处:网络
I\'m开发者_Go百科 running a python script on a remote server with the time command as follows: time python myscript.py

I'm开发者_Go百科 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


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 &


To 1.: Yes

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

nohup time myscript.py > ~/time_output & 
0

精彩评论

暂无评论...
验证码 换一张
取 消