Ali cloud ECS server, some times inexplicable to restart their own. So build a boot log to record when it restart its own.
But this is not enough, Because a few days ago the Ali cloud server appears a strange fault – My VPS web server does not find any problem, but it is can not connect to the database,Want to restart the related services are always reported memory errors, and finally only restart the server manually.
Finally, the most worried before about — the website failed but we cannot detection and treatment timely, because the Ali cloud does not seem to automatically restart at this time. Therefore, it is necessary to build a program, allows the server to restart by self.
Reference to the following code (is a useful code)↓, Now the server achieve a page once every 20 minutes, if the normal exit, else auto record and repair & restart the server.
for /f “usebackq tokens=1* delims=:” %%a in (“%file%”) do (
for /f “usebackq delims=:” %%a in (“%file%”) do if %%a == ifok goto ifok
Deployment is complete, and now waiting to see the treatment effect.
By the way to see the longest for do not restart of Ali cloud ECS server.