0

I have a Ubuntu Linux ec2 instance that's running on AWS. I used the following command

nohup php script.php

so that when I disconnect from the instance with SSH, it still runs. The script contains a huge loop and will take about 4 days to complete.

for($i=0;$i<1000000;$i++) {
    // It does other stuff that's kind of irrelevant

    echo $i.'\n';
}

I was checking the nohup.out file with the vim editor to see if it was still being appended every couple of hours. It seems to have stopped being appended. But, entering ps -ef in the terminal, shows the script as still running.

Any ideas?

  • Just as a side, would you consider using a session multiplexer like screen or tmux instead of nohup? It would be much more elegant. – ewwhite Jul 10 '14 at 23:28
0

The first thing that comes to mind is that the filesystem containing this file could be full. The program would get an error every time it tried to write to the file, but it could be ignoring those.

If the EC2 instance has a copy of the strace program, you can use it to get an idea what the program is doing:

strace -p pid-of-process

will list all of the system calls being performed by the process. If the program mostly does file I/O, then:

strace -e trace=file -p pid-of-process

will list just the filesystem operations being performed. This may be easier to interpret. Either way, this would give you some insight as to what the program is doing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.