0

I am using Ubuntu 12.04, unity. I have a program running in terminal. It is supposed to run for ~10 hours. But it halted after I came back after a few hours. The CPU usage shows that the program is not running. Then I checked the printout by scrolling the terminal window. After I moved the scroll bar to the top (somehow the window is empty and no printout can be seen at the point) and hit the return key, my program resumed suddenly. So, how can I set the parameters so my program won't halt?

Scroll back is set to 1024 lines (the printout from my program is way more than that).

2
  • Can you reproduce it (perhaps it was just a coincidence in your case)? Can you isolate the problem to your terminal and not the running program (try another program and see if it behaves similarly)? Do this before speculating in if it is related to the scroll back buffer. May 25, 2012 at 7:55
  • Hi, Daniel. I am quite sure it is not a coincidence. It just happened again and as soon as I hit the return key, it resumed (also indicated by CPU usage). It is just too unlikely to be a coincidence.
    – HongboZhu
    May 25, 2012 at 9:05

2 Answers 2

1

send it a SIGCONT or SIGALRM to ensure that program is running in the background.i think the kernel is suspending the process.

$ killall -s SIGCONT PROG_NAME

or

$ kill -SIGCONT PROG_PID

Also please check your power option and make sure that system is not sleeping.

PS: you can spawn it as process $./PROG & to ensure it is not terminal problem, OR pipe the output to file to make the buffer happy $./PROG > output.txt

6
  • Hello Maxwell, the OP is asking how to ensure his program continues, not how to terminate it. Perhaps you'd like to edit or delete this answer?
    – Paul
    May 25, 2012 at 8:11
  • @Paul updated :)
    – Maxwell S.
    May 25, 2012 at 8:18
  • Don't forget nohup as in nohup program > program.out 2>&1 & May 25, 2012 at 8:55
  • @MaxwellS. all my processes (actually I have six running in the same terminal) are spawned using &. Piping the output to a file is not realistic since there are a lot output, which can easily exceed a few GB. My desktop was definitely not sleeping.
    – HongboZhu
    May 25, 2012 at 9:08
  • @HongboZhu try to set the scroll back to unlimited; gnome-terminal from "profile preferences" then scrolling and check "unlimited". also can you explain what you are trying to do? i mean if you are not interested in saving output on disk why you are interested to keep it on terminal's screen if you don't want to see them !? if you dont care about output(printout) at all redirect it to ./PROG > /dev/null
    – Maxwell S.
    May 25, 2012 at 10:19
0

From your description I think there's maybe yust an input needed for whatever reasons.

I recently had a similar experience where a script had stalled: It turned out, that script called was performing a mv command and waiting for a confirmation if a file not owned by the current user should be removed, but I couldn't see that message, because unfortunately the programmer of that script had decided to redirect stdout and stderr !

So your problem could be similar to that.

  1. You could try to pipe 'yes' answers to your program: yes | yourprog

  2. You could try to redirect stdin: yourprog </dev/null

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .