在 Windows 2012 Server 上创建了一个任务,用于运行 *.bat 文件。设置为在启动时运行并每 15 分钟重复一次任务。
@ECHO OFF
REM ------------------------------------------------------------------------------------------------------------------------
REM ENVIOS
REM ------------------------------------------------------------------------------------------------------------------------
IF EXIST C:\Indra\AZConnect\Export\Sonae\INVOICFF\*.* (MOVE C:\Indra\AZConnect\Export\Sonae\INVOICFF\*.* C:\Indra\AZConnect\5600000000427INT\INVOICFF\)
IF EXIST C:\Indra\AZConnect\Export\ECI\INVOICFF\*.* (MOVE C:\Indra\AZConnect\Export\ECI\INVOICFF\*.* C:\Indra\AZConnect\8422416999990INT\INVOICFF\)
IF EXIST C:\Indra\AZConnect\Export\Auchan\INVOICFF\*.* (MOVE C:\Indra\AZConnect\Export\Auchan\INVOICFF\*.* C:\Indra\AZConnect\5600000004289INT\INVOICFF\)
REM ------------------------------------------------------------------------------------------------------------------------
REM RECEÇÃO
REM ------------------------------------------------------------------------------------------------------------------------
IF EXIST C:\Indra\AZConnect\5600000004289INT\ORDERSFF\*.* (MOVE C:\Indra\AZConnect\5600000004289INT\ORDERSFF\*.* C:\Indra\AZConnect\Import\ORDERSFF\)
IF EXIST C:\Indra\AZConnect\5600000000427INT\ORDERSFF\*.* (MOVE C:\Indra\AZConnect\5600000000427INT\ORDERSFF\*.* C:\Indra\AZConnect\Import\ORDERSFF\)
IF EXIST C:\Indra\AZConnect\8422416999990INT\ORDERSFF\*.* (MOVE C:\Indra\AZConnect\8422416999990INT\ORDERSFF\*.* C:\Indra\AZConnect\Import\ORDERSFF\)
REM ------------------------------------------------------------------------------------------------------------------------
REM VALIDAÇÃO AZCONNECT EM MEMÓRIA
REM ------------------------------------------------------------------------------------------------------------------------
TASKKILL /F /IM AZCONNECT.EXE
REM ------------------------------------------------------------------------------------------------------------------------
REM RELATÓRIOS
REM ------------------------------------------------------------------------------------------------------------------------
IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (Type C:\Indra\AZCONNECT\PBLIST.TXT >> C:\Indra\AZCONNECT\Reports\PBLIST.txt)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (Type C:\Indra\AZCONNECT\MBLIST.TXT >> C:\Indra\AZCONNECT\Reports\MBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\ICONTROL*.TXT (MOVE C:\Indra\AZCONNECT\ICONTROL*.TXT C:\Indra\AZCONNECT\Reports\)
IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (del C:\Indra\AZCONNECT\PBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (del C:\Indra\AZCONNECT\MBLIST.TXT)
REM ------------------------------------------------------------------------------------------------------------------------
REM COMUNICAÇÕES EDI
REM ------------------------------------------------------------------------------------------------------------------------
REM RASDIAL INDRA <user> <pass>
START /W C:\Indra\AZCONNECT\AZCONNECT.EXE /ER
REM RASDIAL INDRA /disconnect
REM ------------------------------------------------------------------------------------------------------------------------
REM RELATÓRIOS
REM ------------------------------------------------------------------------------------------------------------------------
IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (Type C:\Indra\AZCONNECT\PBLIST.TXT >> C:\Indra\AZCONNECT\Reports\PBLIST.txt)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (Type C:\Indra\AZCONNECT\MBLIST.TXT >> C:\Indra\AZCONNECT\Reports\MBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\ICONTROL*.TXT (MOVE C:\Indra\AZCONNECT\ICONTROL*.TXT C:\Indra\AZCONNECT\Reports\)
IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (del C:\Indra\AZCONNECT\PBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (del C:\Indra\AZCONNECT\MBLIST.TXT)
它工作了几个星期,然后毫无原因地(或者我能找到的原因)它停止了工作。有什么想法是为什么吗?
操作系统是:windows 2012 server r2 foundation
答案1
任务未运行或脚本未运行?如果任务未运行,则您发布的脚本就不重要。如果任务未运行,则我将首先查看任务计划程序的操作事件日志:
事件查看器\应用程序和服务日志\Microsoft\Windows\TaskScheduler\Operational
如果那里没有日志,请右键单击“操作”并选择“启用日志”。重新启动并查看发生了什么。