:START
set PRDDIR=c:\windows\system32\dns
set BCKDIR=%PRDDIR%\backup
set SCSFULDIR=%PRDDIR%\successful.log
set UPDDIR=%PRDDIR%\update
set LOGDIR=%PRDDIR%\log
set DNSLOG=%LOGDIR%\update_dns.log
set BOOT=%PRDDIR%\Boot-Files
REM Check for new zone files in update directory
If not exist %UPDDIR%\db.* goto END_UPDATE
del %SCSFULDIR%\* /Q >nul
REM Time stamp DNS log file
date/T >> %DNSLOG%
time/T >> %DNSLOG%
REM Stop DNS process
net stop dns
if errorlevel 1 goto STOP_ERROR ----- REM NEED ALERT
REM Backup existing zone files
copy %PRDDIR%\*.* %BCKDIR% >nul
REM Copy in new zone files
copy %UPDDIR%\*.* %PRDDIR% >nul
copy %BOOT%\*.* %PRDDIR% >nul
set TRY=1
:RESTART_DNS
REM Restart DNS process
net start dns
if not errorlevel 1 goto RESTART_OK
If %TRY%==2 goto RESTART_ERROR NEED alert has to be triggered-----☻
REM Recover backed up zone files
copy %BCKDIR%\*.* %PRDDIR% >nul
copy %BOOT%\*.* %PRDDIR% >nul
set TRY=2
goto RESTART_DNS
pause
:STOP_ERROR
echo DNS stop FAILED >> %DNSLOG%
goto END_UPDATE
:RESTART_ERROR
echo DNS restart FAILED >> %DNSLOG%
goto END_UPDATE
:RESTART_OK
REM Remove new zone files from update directory
If %TRY%==1 del %UPDDIR%\* /Q >nul rem Update successful ☺
If %TRY%==1 echo DNS restart SUCCESSFUL >> %DNSLOG%
If %TRY%==1 echo DNS restart SUCCESSFUL > % SCSFULDIR %
If %TRY%==2 echo DNS restart RECOVERED >> %DNSLOG%
:END_UPDATE
The idea to add the successful. log is to create another batch file to run in unification and check for a file in the path. If the file is missing then we need to trigger an alert so total there are 3 instances of alert.
I need the syntax to create the batch file which will look for the file successful.log and if not exist send the net send command to the list of ppl identified by their login accounts