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

时间:2023-03-10 01:03:20
定时从linux获取信息放到windows上

环境: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上