I need to check whether a server is up or not? If down then i need to send an email And this task should be repeated in every 30mins.
I have to do this using batch file.
I need to check whether a server is up or not? If down then i need to send an email And this task should be repeated in every 30mins.
I have to do this using batch file.
You can try to access one of its filesystem shares or ping it if you know its IP address. That would be the easiest way and both of them doable from CMD.
To check whether server is up, you can use the ping
command. To send email, you can download email tools like blat
etc. To repeat every 30mins, set it up using task scheduler.
This batch file will get you most of the way there. You'll have to use blat or something similar or Windows script to send the email. Use the task scheduler to call the batch file every 30 minutes.
checkserver.bat:
@echo off
ping -n 1 %1 > NUL
IF ERRORLEVEL 0 (echo "Up -- Don't send email.") ELSE echo "Down -- Send email."
Call it like so:
C:\>checkserver 127.0.0.1
"Up -- Don't send email."
C:\>checkserver 128.0.0.1
"Down -- Send email."