首页 > Windows开发 > 详细

定时从linux获取信息放到windows上

时间:2019-05-31 10:21:12      阅读:156      评论:0      收藏:0      [点我收藏+]

环境:windows上代码路径下存放:WinSCP-5.13.8-Setup.exe

第一步:test.txt   拉取脚本的txt文本

解析:存放从linux路径下拉取所需源文件zyy_count.result

到本地windows的目标路劲改下:D:\zyy\XNresult\

option echo off
option batch on
option confirm off
open scp://root:Uxsino_test@192.168.1.122
cd /home/zyy#进入linux的源文件路径
get zyy_cpu_mem.result D:\zyy\XNresult\
get zyy_count.result D:\zyy\XNresult\
open scp://root:Uxsino_test@192.168.1.122
cd /home/simo
get simo_cpu_mem.result D:\SIMO\XNresult\121\
get simo_count.result D:\SIMO\XNresult\121\
option transfer binary
option synchdelete off
close
exit

 

第二步:主程序将移动脚本文件通过winscp.exe工具移动

move.bat

解析:通过winscp.exe执行上面的test.txt的脚本文件

并将执行日志存放到 /log=D:\SIMO\XNresult\log.txt

@echo off
start /d "D:\profile\WinSCP" WinSCP.exe /y /console /script=D:\SIMO\XNresult\test.txt /log=D:\SIMO\XNresult\log.txt
set /a "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
move D:\SIMO\XNresult\simo_count.result "D:\SIMO\XNresult\simo_count.result%Ymd%"
move D:\SIMO\XNresult\simo_cpu_mem.result "D:\SIMO\XNresult\simo_cpu_mem.result%Ymd%"
move D:\SIMO\XNresult\122\simo_cpu_mem.result "D:\SIMO\XNresult\122\simo_cpu_mem.result%Ymd%"
move D:\SIMO\XNresult\122\simo_count.result "D:\SIMO\XNresult\122\simo_count.result%Ymd%"

 

第三步:设置windows自带的计划任务 执行 move.bat脚本

技术分享图片

 

定时从linux获取信息放到windows上

原文:https://www.cnblogs.com/zyy98877/p/10953461.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!