在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 xxxx027db01.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文件,已经下载下来了。