Results 1 to 3 of 3
Thread: SCP as a background process
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Dec 2006
SCP as a background process
scp -r dir email@example.com:/home2/
I tried to run it as a background process (adding an &), but it just won't do that, as it's requesting a password. I tried to run it without requesting a password (with -B), but then it just spits out "permission denied".
screen is your friend here...
If it's not already installed, install it on the computer you putty into.
Then run screen BEFORE the scp command. This will effectively clear the screen for you. From here, setup the scp command running, then press:
then press D. this will "detatch" the screen session.. It's still running, but not on the screen. You can then logout of putty, and continue as normal, and also at any time, you can log back into the computer through putty, and check the progress. You can do "screen -r" to reconnect the detatched session, then ctrl+a then D again to detatch it again.
HTH"I am not an alcoholic, alcoholics go to meetings"
Registered Linux user = #372327
- Join Date
- Jan 2007
- Cedar Falls/Iowa/USA
The issue here is, when you start SCP or any command, your shell becomes the parent of the new process and its controlling terminal. Once you exit the shell, the controlling terminal dissappears and that kills the child process. So you need to have the process detach from the terminal and run as a background process. The command to do this is nohup. You may also want to send SCP's stdout and stderr to a file:
nohup scp <params> & >nohup.out 2>&1