Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 10-17-2002, 01:10 AM   #1
Titanium Man
Guest
 
Posts: n/a
How to kill ssh without killing another process?

Ok, that was a bad title. What I'm trying to do is ssh into another machine, and start a big fat job. Then I'd like to close my ssh session (without killing the rotund job), and check the status later. Fer example, let's say I'd like to let fink run all night without having to be ssh'ed in the whole time:

% ssh otheruser@othermachine.net

[othermachine:~] otheruser% fink update-all

Should I do 'fink update-all &' to background the process instead? Thanks.
  Reply With Quote
Old 10-17-2002, 01:54 AM   #2
blb
All Star
 
Join Date: Jan 2002
Location: CO, USA
Posts: 908
Safest way would be
Code:
nohup fink update-all > /tmp/fink.log 2>&1 &
for sh-like shells, or
Code:
nohup fink update-all >& /tmp/fink.log &
for csh-like shells. What this does is, with nohup, makes sure your logout won't drop the process (which can happen), and redirects all output to the given log file. This way you can log in later and check the results.
blb is offline   Reply With Quote
Old 10-17-2002, 02:07 AM   #3
Titanium Man
Guest
 
Posts: n/a
Cool, that takes care of step 1 (be able to kill ssh without killing fink update-all), and step 2 (make a log of fink's output to peruse later). Thank you. One last question, though, just for clarification. I could start 'fink update-all' with nohup, and then just hit ^d (Ctrl D) to close the ssh session without affecting the process I've just started, right?
  Reply With Quote
Old 10-17-2002, 03:23 AM   #4
zed
Major Leaguer
 
Join Date: Sep 2002
Location: Earth
Posts: 381
correct...

check the man page for nohup

man nohup

the nohup basically stop the process from being affected by the terminal that ran it, ie it won't die when you log out...

The only thing.... obviously you can only runn commands that are not going to want input from the terminal.

Cheers,

--Zed
zed is offline   Reply With Quote
Old 10-17-2002, 04:36 AM   #5
bakaDeshi
Triple-A Player
 
Join Date: Apr 2002
Location: Restaurant at the End of the Universe
Posts: 171
TiMan,

This is what I do.

Login-ssh
screen
fink update-all
^a then d (Cont -a then d, detaches)
close ssh session.

course you need to install screen.

-hth
__________________
—bakaDeshi
Caution! Mac User at the Command
Line.
bakaDeshi is offline   Reply With Quote
Old 10-17-2002, 10:45 AM   #6
Titanium Man
Guest
 
Posts: n/a
Thanks everyone! I had wondered if screen would do this. I guess I'll have to try both ways.
  Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 10:31 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.