Saturday 8 September 2012

run scp as background process



http://www.conacent.com

I had a problem to transfer big file from server A to server B and don't want to wait until transfer process is completed. How to keep scp running even terminal session is closed.
My solution is using scp with nohup.
1$nohup scp *.tar user@server:/e01/backup/ &
But the problem with the above code is, scp require password to enter before you can use it. (other method, create ssh signed key)
to solve this problem. We can do the following step
1. run nohup
1$nohup scp  *.tar user@server:/e01/backup/  nohup.out 2>&1
by default, nohup is not running at background. wait until scp asking for the password.
2. enter your password.
3. press ctrl + z to temporary suspend the command.
4. enter bg command
1$bg
now your scp is running at background. You can close your terminal 

No comments:

Post a Comment