I would like to implement a dead man’s switch for Seafile: every few minutes, my server running Seafile should contact another server (in my case: https://healthchecks.io) that it is still alive. When this report does not happen, the second server will contact me.
For that, I need a reliable way to check whether Seafile server is working properly. Do you have any ideas how to accomplish that?
A while ago I found out that checking Seafile or Seahub’s systemd service is not enough, so I used the API functionality together with a Nagios official plugin. This http plugin (called check_http) can run locally (or from a remote Nagios server)
If you don’t want to install nagios, use bash: [[ $(curl -Ss "https://my.seafile-server.net/api2/ping/") == "\"pong\"" ]] && exit 0 || exit 1
If curl doesn’t trust your certificate, use -Ssk as options for curl (instead of -Ss).
The exit code is 0 if the server replies as expected, otherwise it will be 1.