0

I connect to some mac machine using SSH and run a command similar to:

nohup /var/root/install.sh param1 param2 </dev/null >/var/root/vvv.out 2>&1 & echo '' ; echo ERROR_CODE:$?

It seems to work fine, but if I close the session in the middle of the install, the session gets stuck and is visible using the ps command.

The same trick seems to work successfully on Linux machines.

Any ideas?

Edit: Environment details are 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh powerpc

Could it be that this version is just too old? According to Wikipedia powerpcs were supported until until August 2006.

4 Answers 4

3

I'd guess that this is because the process is still owned by its controlling-terminal, and it gets confused when that goes away. If you're using bash at the far end, you could try adding a call to disown to reparent it.

1

i think there's a difference between "shell builtin" nohup and the program nohup. You might also, hopefully, get around that with ssh -n instead of plain ssh.

My macbook is a dead brick for some time already this is why i'm guessing only. :)

0
+50

You are right, it's not certain that it will work. I think this might have something do to with the fact that OS 10 is based on Unix, and they don't use the same revision of nohup or something. I'm not sure but I tried nohup on SunOS 5.10 and it didn't work the same way as on linux.

This brought my attention to a lovely program called screen. As I remember, screen is available by default on UNIX/Linux systems.

Use [CTRL] - A, then press D to jump out of screen. Use screen -r to resume the session. If you are running multiple instances of screen, you will see the process-id's of each screen instance automatically, and you will have to specify the process by typing screen -r #process-id.

hint: You can run the same instance of screen on multiple logins at the same time by invoking screen -x This is useful for ssh or just different terminals on the same computer. Very useful if you have a laptop plugged in via serial consoles and you can't bring the computer with you. screen can interact with serial devices.. just try screen /dev/ttyS0 or whatever the name of the device is!

hf

0

You have an echo at the end of the command line, but where is that echo supposed to go if you've closed the terminal ? Where does the echo go on Linux ? I would be curious what would happen if you removed the echos at the end and ran it just as a test.

You could script the whole thing and redirect the output to an email or file.

You must log in to answer this question.

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