In case of an error let the shell script touch an empty lock file somewhere, maybe /tmp/server_status.lck for example, so it can remember on next check, what former status was. Example:
server offline and no lock file -> new status so touch lock file and send mail
server offline and lock file exists -> do nothing, just a log entry
server online and lock file exists -> delete lock file and send mail that all is ok again
server online and lock file does not exist -> do nothing, just a log entry
Easy to cover with some "if/then/fi" and "else" constructs.