Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to transfer a large number of files over SFTP (only between Solaris servers) which takes a very long time. I cannot keep my PC on for this duration. I tried:

nohup sftp server1

While the shell is open, I see files are downloaded. When I close the shell it stops. In ps -ef I don't see the sftp process. The file nohup.out states: Killed by signal 15

If instead I do ctrl-z, bg, disown it works. However this requires the bash shell. I'd prefer a solution for ksh.

Thanks.

share|improve this question
add comment

4 Answers

up vote 3 down vote accepted
  • Start your sftp session as usual: sftp server1
  • Put it in the background with Ctrl+Z
  • Disconnect it from its parent with nohup -ga $(pgrep sftp)
share|improve this answer
1  
jlliagre, this is pretty much it. i had to do: nohup -ga $(pgrep sftp). thanks much! –  anurag kohli Dec 1 '10 at 19:16
    
Thanks, updating my reply according to your comment. –  jlliagre Dec 2 '10 at 8:29
add comment

Sounds like a perfect task for GNU Screen.

share|improve this answer
    
ErikA, I'm using Unix (Solaris) so unfortunately this won't work. –  anurag kohli Nov 30 '10 at 21:30
1  
Looks like it's easy enough to install: sun.com/bigadmin/features/articles/gnu_screen.jsp –  EEAA Nov 30 '10 at 21:56
    
I also don't have root access to this particular server :( –  anurag kohli Nov 30 '10 at 22:34
add comment

I don't use KSH myself, but have you tried:

nohup sftp server1 &
share|improve this answer
    
I tried this but doesn't seem to work. When I put in my password I get: ksh: opticall: not found (opticall is the password for server1) –  anurag kohli Nov 30 '10 at 21:25
    
@anurag kohli - Do you have access to Perl with the Expect module? –  Tok Nov 30 '10 at 23:09
    
@anurag kohli: Does it work if you do nohup sftp server1 (no &), enter your password, then do Ctrl-z and bg (no disown should be necessary since you have nohup) in ksh? –  Dennis Williamson Dec 1 '10 at 1:24
    
@Dennis Williamson: Unfortunately this does not work. –  anurag kohli Dec 1 '10 at 18:59
add comment

Could you not use scp in a script ? This is non-interactive and therefore doesnt require a terminal, and will work fine with nohup.

share|improve this answer
    
Chris, I could look into this. However I don't have root access to this particular server so not sure if this is viable. –  anurag kohli Nov 30 '10 at 21:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.