@echo off REM #################################### REM Description: This script is used to send email notifications for the REM smartmontools service on server.test.com. REM Required files: hostname, tr, blat REM Last modified: March 27, 2010 REM #################################### REM ################ REM Set variables REM ################ set hostname="C:\WINDOWS\system32\hostname.exe" %hostname% > %hostname_results%# for /f "tokens=1" %%x in (%hostname_results%#) do (set host=%%x) del /f /q # > nul 2>&1 set tr="C:\Program Files\System Utilities\bin\tr.exe" echo %host% | %tr% '[:upper:]' '[:lower:]' > %lowercase_results%# for /f "tokens=1" %%x in (%lowercase_results%#) do (set host=%%x) del /f /q # > nul 2>&1 set month=%date:~-10,2% set day=%date:~-7,2% set year=%date:~-2,2% set current_day=%month%/%day%/%year% set hour=%time:~-11,2% REM put a leading zero for hours before 10 AM if "%time:~0,1%"==" " set hour=0%hour:~1,1% set minute=%time:~-8,2% set second=%time:~-5,2% set current_time=%hour%:%minute%:%second% set blat="C:\WINDOWS\system32\blat.exe" set recipient="%SMARTD_ADDRESS%" set profile="test.com" set subject="System Alert: Smartd warning (%SMARTD_FAILTYPE%) on %host% [%current_day% %current_time%]" %blat% - -to %recipient% -subject %subject% -p %profile% -q > nul 2>&1 exit