LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   How can you view the progress of a process started in a non-interactive shell? (http://www.linuxquestions.org/questions/linux-general-1/how-can-you-view-the-progress-of-a-process-started-in-a-non-interactive-shell-720544/)

timingalls 04-20-2009 07:51 PM

How can you view the progress of a process started in a non-interactive shell?
 
I am wondering if there is a way to view the progress or standard output of a process running in a non-interactive shell. For example, I am running Ubuntu, and from the shell I issued the following commands from my Palm Treo on my bus ride home:

Code:

# at 6:12 PM
>apt-get dist-upgrade --yes
>(CTRL-D)
#

Later, I wanted to find out where in the process the upgrade was, if it was stuck, if it was waiting for some type of input, etc. Running
Code:

ps -A u
showed me that the process was still running. I wondered if something had gone wrong or if it was stalled for some reason, but I didn't know how to view any of the output of the process. I guess next time I should redirect standard output to a file (if I can figure that out), but I'm still wondering if there is a way to view the output of the process while it is running.

Does anyone know how to jump into the middle of a process like this and redirect its standard output?

MensaWater 04-21-2009 02:29 PM

Not really possible after you started it.

However, before you start it next time you can use the "screen" command to open a session that is detachable and attachable. This allows you to start a process on one device then later view it on another (or at same time).

Type "man screen" for more details.

As to what is running now:
You might want to run "lsof -p <PID>" on the process currently running to see what files it has open. Perhaps there's a log somewhere that you can view to see what is going on. Failing that having a look in /var/log may give you some hints.


All times are GMT -5. The time now is 09:05 AM.