Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Echo Off
- SetLocal EnableDelayedExpansion
- Set $COUNTE1=0
- Set $ONETIMECOUNTER=0
- Set $D=E
- Set $COMPARE="Device is in ACTIVE or IDLE mode"
- :BackLog
- For /F "Delims=" %%I In ('smartctl.exe -n standby %$D%:') Do Set $RESULTA=%%~I
- :: Убираем кавычки
- Set $RESULTA="%$RESULTA%"
- If %$ONETIMECOUNTER%==0 (
- echo %date% %time% %$RESULTA%
- echo.
- If %$RESULTA%==%$COMPARE% (
- echo.>> StandbyLog_%$D%.txt
- echo Bat file is started:>> StandbyLog_%$D%.txt
- echo %date% %time% %$D% - Disk is ACTIVE>> StandbyLog_%$D%.txt
- echo.>> StandbyLog_%$D%.txt
- echo Log:>> StandbyLog_%$D%.txt
- If %$RESULTA%==%$COMPARE% (
- set $COUNTE1=0
- )
- ) else (
- echo.>> StandbyLog_%$D%.txt
- echo Bat file is started:>> StandbyLog_%$D%.txt
- echo %date% %time% %$D% - Disk is STANDBY>> StandbyLog_%$D%.txt
- echo.>> StandbyLog_%$D%.txt
- echo Log:>> StandbyLog_%$D%.txt
- If not %$RESULTA%==%$COMPARE% (
- set $COUNTE1=1
- )
- )
- set $ONETIMECOUNTER=1
- )
- If %$COUNTE1%==1 (
- If %$RESULTA%==%$COMPARE% (
- echo %date% %time% %$RESULTA%
- echo %date% %time% %$D% - Disk is ACTIVE>> StandbyLog_%$D%.txt
- set $COUNTE1=0
- )
- )
- If %$COUNTE1%==0 (
- If not %$RESULTA%==%$COMPARE% (
- echo %date% %time% %$RESULTA%
- echo %date% %time% %$D% - Disk is STANDBY>> StandbyLog_%$D%.txt
- echo.>> StandbyLog_%$D%.txt
- set $COUNTE1=1
- )
- )
- TIMEOUT /T 1 /NOBREAK >nul
- goto :BackLog
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement