version 1.1, 2013/07/22 01:17:36
|
version 1.1.1.2, 2013/10/14 07:54:04
|
Line 2
|
Line 2
|
:: |
:: |
:: smartd warning script |
:: smartd warning script |
:: |
:: |
:: Copyright (C) 2012 Christian Franke <smartmontools-support@lists.sourceforge.net> | :: Copyright (C) 2012-13 Christian Franke <smartmontools-support@lists.sourceforge.net> |
:: |
:: |
:: This program is free software; you can redistribute it and/or modify |
:: This program is free software; you can redistribute it and/or modify |
:: it under the terms of the GNU General Public License as published by |
:: it under the terms of the GNU General Public License as published by |
Line 33 if not "%1" == "" (
|
Line 33 if not "%1" == "" (
|
echo set SMARTD_MESSAGE='Error Message' |
echo set SMARTD_MESSAGE='Error Message' |
echo set SMARTD_FAILTYPE='Type of failure, "EMailTest" for tests' |
echo set SMARTD_FAILTYPE='Type of failure, "EMailTest" for tests' |
echo set SMARTD_TFIRST='Date of first message sent, empty if none' |
echo set SMARTD_TFIRST='Date of first message sent, empty if none' |
echo set SMARTD_TFIRSTEPOCH='time_t format of above' | echo :: set SMARTD_TFIRSTEPOCH='time_t format of above' |
echo set SMARTD_PREVCNT='Number of previous messages, 0 if none' |
echo set SMARTD_PREVCNT='Number of previous messages, 0 if none' |
echo set SMARTD_NEXTDAYS='Number of days until next message, empty if none' |
echo set SMARTD_NEXTDAYS='Number of days until next message, empty if none' |
echo set SMARTD_DEVICEINFO='Device identify information' |
echo set SMARTD_DEVICEINFO='Device identify information' |
Line 50 if "%SMARTD_ADDRESS%%SMARTD_MAILER%" == "" (
|
Line 50 if "%SMARTD_ADDRESS%%SMARTD_MAILER%" == "" (
|
goto EOF |
goto EOF |
) |
) |
|
|
|
:: USERDNSDOMAIN may be unset if running as service |
|
if "%USERDNSDOMAIN%" == "" ( |
|
for /f "delims== tokens=2 usebackq" %%d in (`WMIC PATH Win32_Computersystem WHERE "PartOfDomain=TRUE" GET Domain /VALUE 2^>nul ^| find "Domain=" 2^>nul`) do set USERDNSDOMAIN=%%~d |
|
) |
|
|
:: Format subject |
:: Format subject |
set SMARTD_SUBJECT=SMART error (%SMARTD_FAILTYPE%) detected on host: %COMPUTERNAME% |
set SMARTD_SUBJECT=SMART error (%SMARTD_FAILTYPE%) detected on host: %COMPUTERNAME% |
|
|
:: Temp file for message |
:: Temp file for message |
if not "%TMP%" == "" set SMARTD_FULLMSGFILE=%TMP%\smartd_warning-%DATE%-%RANDOM%.txt | if not "%TMP%" == "" set SMARTD_FULLMSGFILE=%TMP%\smartd_warning-%RANDOM%.txt |
if "%TMP%" == "" set SMARTD_FULLMSGFILE=smartd_warning-%DATE%-%RANDOM%.txt | if "%TMP%" == "" set SMARTD_FULLMSGFILE=smartd_warning-%RANDOM%.txt |
|
|
:: Format message |
:: Format message |
( |
( |