Forum Moderators: travelin cat

Message Too Old, No Replies

MacOSX observe process commands

How close can a process be observed?

         

Yidaki

3:54 pm on Jul 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Imagine the following situation:

At my iBook at home i start a process at a remote MacOSX 10.2.6 machine via ssh. The process starts and echoes what has been scripted. In my terminal i see:

> [process12345] doing this ...
> [process12345] doing that ...
> [process12345] doing also this ...
> [process12345] now i do this ...

Now i close the terminal window and the process keeps running on the remote mac as it should. Ten minutes later i login again (ssh) and would like to have the current echo messages like above. Any way to get them?

So far i know the following commands:

- sudo sc_usage [pid]
Returns a lot of informations about the process - but not the echo log.

- sudo fs_usage
Just reports about the hard disc usage of the processes that are running.

Is there any command that can be used to jump back into the process and observe the calling chain and the echo messsages? Hope, you get the question.

bakedjake

8:10 pm on Jul 28, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month




1. Simple solution: Pipe the output to a file:

# /usr/local/bin/script > output.txt &

That will output whatever the script echos to the output.txt file.

2. Complex Solution: You could use GNU Screen, which creates virtual terminals that continue running even when you log out. You'll probably have to download and compile it, as I don't *think* it comes with OS X (but it might).

To run the command with screen, and detach the process, it would go something like this:


# screen
# /usr/local/bin/script
# (ctrl-a, d)

Then logout. When you log back in, and are ready to view the output, do:

# screen -r

Hope that helps!

Yidaki

8:54 pm on Jul 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hehehe, i see you edited your post - makes much more sense for me now - thanks. ;)

I'll try the ouput option tomorrow!

However, allthough screen works it's more a screen capture command, no!? I get a blank terminal screen with this command - i guess this is because the terminal isn't running on the remote machine - thus white screen, right!? ...