scp后台运行获取远程服务器文件

执行命令

[root@localhost seafile]# scp root@ip:/var/seafile/shared.tar.gz .
root@ip's password: 
Permission denied, please try again.
root@ip's password: 
Permission denied, please try again.
root@ip's password: 
shared.tar.gz

ctl+z暂停

[1]+  已停止               scp [email protected]:/var/seafile/shared.tar.gz .

后台查看jobs,目前是停止运行

[root@localhost seafile]# jobs
[1]+  已停止               scp [email protected]:/var/seafile/shared.tar.gz .

让scp程序后台运行,bg %{jobid这里是1}

[root@localhost seafile]# bg %1
[1]+ scp [email protected]:/var/seafile/shared.tar.gz . &
[root@localhost seafile]# ps -ef|grep scp
root     29445  1455  0 15:09 pts/0    00:00:00 scp [email protected]:/var/seafile/shared.tar.gz .
root     29446 29445  0 15:09 pts/0    00:00:00 /usr/bin/ssh -x -oForwardAgent=no -oPermitLocalCommand=no -oClearAllForwardings=yes -l root -- 120.77.248.3 scp -f /var/seafile/shared.tar.gz
root     29538  1455  0 15:10 pts/0    00:00:00 grep --color=auto scp

查看jobs,目前状态为运行中,已经在后台运行

[root@localhost seafile]# jobs
[1]+  运行中               scp [email protected]:/var/seafile/shared.tar.gz . &

你可能感兴趣的:(scp后台运行获取远程服务器文件)