Este script permite iniciar num CMD uma cópia de ficheiros com o Robocopy, escreve logs e ainda escreve no event viewer da máquina.
@REM COPY SYSFileStore
cls
eventcreate /ID 100 /L APPLICATION /T INFORMATION /SO SYSBackupFileStore /D "SYSBackupFileStore Starting Process"
set TodayStr=%date:~6,4%-%date:~3,2%-%date:~0,2% %time:~0,2%^:%time:~3,2%^:%time:~6,2%
set TodayFile=copySYSfilestore_robocopy_status_%date:~6,4%-%date:~3,2%-%date:~0,2%.log
set ActualRobocopyFile=copySYSfilestore_robocopy.log
set PATH1=C:\DIR1
set PATH2=C:\DIR2
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| ********************************************* >> %TodayFile%
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| SYSFileStore started >> %TodayFile%
IF NOT EXIST %PATH2% (
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| This node is not the active node >> %TodayFile%
) ELSE (
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| Starting Robocopy : Must see the last robocopy file log >> %TodayFile%
Robocopy %PATH1% %PATH2% /MIR /FFT /Z /XA:H /W:1 /NFL /R:1 /LOG:%ActualRobocopyFile% & taskkill /F /IM robocopy.exe)
)
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| SYSFileStore ended >> %TodayFile%
eventcreate /ID 999 /L APPLICATION /T INFORMATION /SO SYSBackupFileStore /D "SYSBackupFileStore Ended Process"
:END
exit /b %ERRORLEVEL%
Sem comentários:
Enviar um comentário