LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-01-2006, 07:08 PM   #1
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Rep: Reputation: 30
leaving an SSH session without terminating a task??


I have inadvertantly got a huge rsync running in my ssh terminal session and it seems that I might kill the rsync and lose all the transfered data if I close the ssh terminal window.

Will closing the window that has the ssh session within close the ssh session itself (I believe it does) and kill the rsync that terminal is in the middle of>?

And can I background that current task or will I just have to start again and remember to use & at the endof the rsync command?

Is screen more like what I need?

TIA

Will

Last edited by stardotstar; 03-01-2006 at 07:17 PM.
 
Old 03-01-2006, 07:14 PM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
Code:
nohup <command> &
and then it won't kill the process when you close the session
 
Old 03-01-2006, 07:14 PM   #3
puffinman
Member
 
Registered: Jan 2005
Location: Atlanta, GA
Distribution: Gentoo, Slackware
Posts: 217

Rep: Reputation: 31
Yes, closing the session terminates all tasks running. Using & won't alleviate this problem either, since it's still a child process of the shell. You need to use the nohup (short for "no hangup") utility to allow tasks to continue running after closing a terminal session. See the man page for details.
 
Old 03-01-2006, 07:40 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
The screen command may also be useful. You can detach from your session and re-attach to it later. There's an overview at http://www.kuro5hin.org/story/2004/3/9/16838/14935which may be useful.
 
Old 03-01-2006, 09:28 PM   #5
sipsipi
Member
 
Registered: Dec 2005
Location: Chicago
Distribution: Fedora and Redhat
Posts: 86

Rep: Reputation: 15
I might also do an "at" job for this type of thing.

http://www.computerhope.com/unix/uat.htm
 
Old 03-02-2006, 03:55 PM   #6
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
Guys, I had problems with this last night.


I was attempting to execute an rsync that required the remote ssh login. So I put it in like

#nohup rsync [blah blah] me@remote:: &

and it accepted that and then when it asked me to accept the certificate [yes/no] and I typed yes it spooled y's down the left side of the terminal and had to be ctrl-c broken...

So I accepted the certificate separately and then re executed the command and the rsync was given a pid and then I was asked for the pass - then I got [ stopped ] and when I tried to exit the shell session I was warned of stopped tasks - I am confused now - so I left it for now!

I have managed to rsync small directories and files without hassel using a direct ssh connection and not quitting it midstream but this is ment to be the main tree backup of my remote system and I need to get the initial 2.8G of data across before the rsync size and session length becomes trivial. Help anyone? Many Thansk

will
 
Old 03-03-2006, 07:05 PM   #7
puffinman
Member
 
Registered: Jan 2005
Location: Atlanta, GA
Distribution: Gentoo, Slackware
Posts: 217

Rep: Reputation: 31
Why don't you try pulling the data to your machine instead of pushing it from the other? That is, say the machine you want the files from is OVERTHERE, and the one you're at is HERE. Right now you're sshing OVERTHERE and then:

Code:
you@OVERTHERE $ rsync ~/stuff you@HERE:~/stuff
Instead you can just rsync from HERE, like this:

Code:
you@HERE $ rsync you@OVERTHERE:~/stuff ~/stuff
 
Old 03-03-2006, 08:59 PM   #8
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
You d'man!

That has got it sorted. I am easily pulling 200kps and the job looks like taking 4 hours instead of 59 and then stalling and aborting! Thanks heaps>
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Killing an SSH Session chatmasta Linux - Networking 5 05-27-2015 02:51 AM
persistent ssh session apepost Linux - Networking 4 11-12-2005 12:16 AM
SSH Session Monitoring? totalrockage Linux - Networking 1 04-08-2005 01:01 AM
PHP: Best way to preserve session data when leaving a domain? Locura Programming 0 03-13-2004 03:40 PM
ssh session freezing andyn Linux - Networking 4 11-10-2003 10:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration