scp 手动输入密码后后台执行的方法
2012-06-17 13:27:19| 分类: 默认分类|举报|字号 订阅
[root@monitor snow]# nohup scp -P9922 -r src snow@192.168.6.165:/home/snow/data/ &
[1] 11488
[root@monitor snow]# nohup: appending output to `nohup.out'
snow@192.168.6.165's password:
注:点击确定(驾车键)
[1]+ Stopped nohup scp -P9922 -r src snow@192.168.6.165:/home/snow/data/
查看进程号
[root@monitor snow]# ps -a
PID TTY TIME CMD
11409 pts/0 00:00:00 su
11410 pts/0 00:00:00 bash
11488 pts/0 00:00:00 scp
11489 pts/0 00:00:00 ssh
11490 pts/0 00:00:00 ps
暂停scp进程
[root@monitor snow]# kill -stop 11488
查看运行在后台但已经暂停的进程
[root@monitor snow]# jobs
[1]+ Stopped nohup scp -P9922 -r src snow@192.168.6.165:/home/snow/data/
将进程在前台执行(方便输入密码)
[root@monitor snow]# fg 1
nohup scp -P9922 -r src snow@192.168.6.165:/home/snow/data/
snow@192.168.6.165's password: (输入密码)
然后按“ctrl+z”键将进程暂停
[1]+ Stopped nohup scp -P9922 -r src snow@192.168.6.165:/home/snow/data/
查看进程是否在运行
[root@monitor snow]# ps -ef |grep scp
root 11488 11410 0 13:13 pts/0 00:00:00 scp -P9922 -r src snow@192.168.6.165 /home/snow/data/
root 11489 11488 0 13:13 pts/0 00:00:00 /usr/bin/ssh -x -oForwardAgent no -oPermitLocalCommand no -oClearAllForwardings yes -p9922 -lsnow 192.168.6.165 scp -r -t /home/snow/data/
root 11492 11410 0 13:14 pts/0 00:00:00 grep scp
查看后台暂停的进程号(scp):
[root@monitor snow]# jobs
[1]+ Stopped nohup scp -P9922 -r src snow@192.168.6.165:/home/snow/data/
将进程放到后台执行:
[root@monitor snow]# bg 1
[1]+ nohup scp -P9922 -r src snow@192.168.6.165:/home/snow/data/ &
[root@monitor snow]#