在Xshell中上傳下載文件到本地(linux中從多次ssh登錄的dbserver裡面的文件夾)
1 列出所有需要copy的sh文件
-bash-4.1$ ll /mysqllog/osw/*.sh
-rwxr-xr-x 1 mysql mysql 409 May 16 10:00 /mysqllog/osw/topaix.sh
-rwxr-xr-x 1 mysql mysql 127 May 16 10:00 /mysqllog/osw/tarupfiles.sh
-rwxr-xr-x 1 mysql mysql 556 May 16 10:00 /mysqllog/osw/stopOSW.sh
-rwxr-xr-x 1 mysql mysql 1609 May 16 10:00 /mysqllog/osw/startOSW.sh
-rwxr-xr-x 1 mysql mysql 398 May 16 10:00 /mysqllog/osw/oswsub.sh
-rwxr-xr-x 1 mysql mysql 330 May 16 10:00 /mysqllog/osw/oswnet.sh
-rwxr-xr-x 1 mysql mysql 636 May 16 10:00 /mysqllog/osw/oswlnxtop.sh
-rwxr-xr-x 1 mysql mysql 634 May 16 10:00 /mysqllog/osw/oswlnxio.sh
-rwxr-xr-x 1 mysql mysql 15598 May 16 10:00 /mysqllog/osw/OSWatcher.sh
-rwxr-xr-x 1 mysql mysql 5586 May 16 10:00 /mysqllog/osw/OSWatcherFM.sh
-rwxr--r-- 1 mysql mysql 567 May 16 10:00 /mysqllog/osw/mysql_status.sh
-rwxr--r-- 1 mysql mysql 617 May 16 10:00 /mysqllog/osw/mysql.sh
-rwxr--r-- 1 mysql mysql 587 May 16 10:00 /mysqllog/osw/mysql_inno_status.sh
2 從遠程db服務器上copy出來sh到控制機器的novamysqladminprod帳號目錄下:
2.1 進入osw目錄並且copysh文件
cd /home/novamysqladminprod/cacti/osw
scp eanprdnucmydbc027db01.eao.abn-iad.ea.com:/mysqllog/osw/*.sh ./
cp * /tmp/osw/
2.2 退出control機器
[novamysqladminprod@mydbctl osw]$ exit
logout
[chm@mydbctl osw]$ exit
logout
[chm@linuxbh1-p osw]$ scp mydbctl.eao.abn-iad.ea.com:/tmp/osw/* /tmp/osw
Password:
mysql_inno_status.sh 100% 587 0.6KB/s 00:00
mysql.sh 100% 617 0.6KB/s 00:00
mysql_status.sh 100% 567 0.6KB/s 00:00
OSWatcherFM.sh 100% 5586 5.5KB/s 00:00
OSWatcher.sh 100% 15KB 15.2KB/s 00:00
oswlnxio.sh 100% 634 0.6KB/s 00:00
oswlnxtop.sh 100% 636 0.6KB/s 00:00
oswnet.sh 100% 330 0.3KB/s 00:00
oswsub.sh 100% 398 0.4KB/s 00:00
startOSW.sh 100% 1609 1.6KB/s 00:00
stopOSW.sh 100% 556 0.5KB/s 00:00
tarupfiles.sh 100% 127 0.1KB/s 00:00
topaix.sh 100% 409 0.4KB/s 00:00
2.3 check sh files in linuxbh servers
[chm@linuxbh1-p osw]$ pwd
/tmp/osw
[chm@linuxbh1-p osw]$ ll
total 68
-rwxr--r-- 1 chm chm 587 Sep 2 08:06 mysql_inno_status.sh
-rwxr--r-- 1 chm chm 617 Sep 2 08:06 mysql.sh
-rwxr--r-- 1 chm chm 567 Sep 2 08:06 mysql_status.sh
-rwxr-xr-x 1 chm chm 5586 Sep 2 08:06 OSWatcherFM.sh
-rwxr-xr-x 1 chm chm 15598 Sep 2 08:06 OSWatcher.sh
-rwxr-xr-x 1 chm chm 634 Sep 2 08:06 oswlnxio.sh
-rwxr-xr-x 1 chm chm 636 Sep 2 08:06 oswlnxtop.sh
-rwxr-xr-x 1 chm chm 330 Sep 2 08:06 oswnet.sh
-rwxr-xr-x 1 chm chm 398 Sep 2 08:06 oswsub.sh
-rwxr-xr-x 1 chm chm 1609 Sep 2 08:06 startOSW.sh
-rwxr-xr-x 1 chm chm 556 Sep 2 08:06 stopOSW.sh
-rwxr-xr-x 1 chm chm 127 Sep 2 08:06 tarupfiles.sh
-rwxr-xr-x 1 chm chm 409 Sep 2 08:06 topaix.sh
[chm@linuxbh1-p osw]$
it is ok ,all the sh files are here.
3 copy the sh files to local pc D:\osw\
google得到如下幫助信息:
XShell上傳與下載文件命令sz,rz
sz test.log 下載文件名為test.log到本地
rz 上傳文件到遠程服務器
rz -y 覆蓋已存在文件
我這裡需要用的是sz命令,如下圖所示:
再去本地check sh文件,已經下載下來了。