2

I am currently running mathematica on a Linux cluster, I want the job running stably even if I log out. So I use nohup. However, I found sometimes nohup terminates without any sign (I can't see any error message in the output file, it just stopped in the middle of a calculation.)

It maybe due to Mathematica. But I think maybe I should try screen. So I came up with this question. What is the difference between nohup and nohup in a screen? Will nohup inside a screen more stable than merely nohup?

1 Answer 1

3

It will not make a real difference, in the sense that if you run screen (or tmux) and you disconnnect there will be NOHUP signal sent to your application whether you start it with nohup or not.

I suggest you try it out by using screen/tmux and just start the program without nohup. Then forecfully disconnect, login and again and reattach to the previous session. You'll see that your session just keeps on working and that you can see its output (scrolling back in the buffer requires some special commands) and that you can (probably) interrupt the running program by pressing Ctrl+C, essentially as if you never disconnected.

So where your original program somehow terminates unexpectedly and hopefully writes to nohup.out what is the cause, now that output goes to the screen session buffer. But if it doesn't output anything when using nohup you will not get more information when running inside screen. It is not nohup that terminates, it is your program that does, despite running "under" nohup.

4
  • Hi, Anthon. Thank you for answering. I don't understand " if it doesn't output anything when using nohup you will not get more information when running inside screen". If all the output including error are redirected to file, what else am I missing from nohup.out? Commented Apr 30, 2016 at 7:22
  • 1
    @user15964 I really think your program crashes without generating any output for some unknown reason and that it doesn't write a termination message before it does so. Otherwise it would be in the nohup.out (or any file you use for redirecting). Running under screen is not going to help you there. Commented Apr 30, 2016 at 7:50
  • Sorry for my unclear post. Actually my program generate outputs at first, however sometimes it just stopped in the middle without any error message. Just "peacefully" stopped without any traceable info. Ok, I want to make sure one point: Is nohup at the same safety level as screen in terms of background job stability? Commented Apr 30, 2016 at 8:12
  • @user15964 Yes it is at the same level. Commented Apr 30, 2016 at 8:55

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.