Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. 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; how can I do this in ksh?

share|improve this question
add comment

3 Answers

You can do Ctrl+Z, bg, disown in ksh as well. You'd want that in addition to nohup, i.e.,

nohup sftp server1
...
<Ctrl+Z>
bg
disown

However my recommendation here would be to use screen. In OpenSolaris, it's in the SUNWscreen package. Run screen, which starts a shell in a new virtual terminal. Run sftp server inside that shell (you can also directly run screen sftp server). Initiate your transfer, then type Ctrl+A D to disconnect (“detach”) from the screen session. The processes inside the session will keep running. Later, you can reattach to that screen session with screen -rd.

share|improve this answer
1  
hi gilles. disown does not work in ksh. here's the error i get: ksh: disown: not found. that said, i agree with the use of screen. however i don't have root access to this particular server so i won't be able to install GNU screen. –  anurag kohli Nov 30 '10 at 23:02
1  
@anurag: Oh, disown is in OpenSolaris, I didn't think it was a new feature. You should be able to just drop a screen executable or compile it from source and put it in your account — at least on OpenSolaris screen doesn't need any extra permission. Failing that you could install a bash executable in your account. –  Gilles Nov 30 '10 at 23:41
add comment
up vote 1 down vote accepted
  1. SFTP as normal
  2. Ctrl-z
  3. nohup -ga $(pgrep sftp)
share|improve this answer
2  
What is that "item" thing at the end of the nohup command ? serverfault.com/questions/207593/using-nohup-on-solaris-10 –  jlliagre Dec 4 '10 at 10:26
add comment

if you in ksh under Solaris following is just a single step for all:

% nohup command > command.log 2>&1 &

it is ok if you exit then your ksh terminal.

share|improve this answer
add comment

Your Answer

 
discard

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