if you need to check if the server is accessible, cause a restart or something else, you can try to make wget on the server and analyze the answer or error, if you get 200 or even 404, the server you can change the wget timeout with - timeout = seconds, you can set the timeout to 10 seconds and loop until the grep result of the response reaches the result.
I don't know if this is really what you are looking for, or if you really need bash code.
Clot Aug 10 2018-12-12T00: 00Z
source share