Check status of Seafile server


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: 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?


Can’t you use the snippets on the linked website?

Actually, I wanted to have a check whether the Seafile server software is still running properly (in case of a software freeze, for instance).

For now, I am using systemctl is-active seafile.service. No idea whether it catches all kinds of errors but it serves its purpose for the moment.

Just in case someone else needs a similar solution, here is the script which cron run every 15 minutes:

if [ “systemctl is-active seafile.service” == “active” ]
curl --retry 3

BHey BayerSe,

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)

/usr/local/nagios/libexec/check_http -H my.seafile.local -p 8000 -u ‘/api2/ping/’ -s pong
/usr/local/nagios/libexec/check_http -H my.seafile.local -p 8000 -u ‘/accounts/login/’

This check_http plugin can be obtained from Nagios Plugins | Nagios Open Source or as a package from repositories (depending on your OS).

If the plugin detects a non-OK state the exit code will be higher than 0 (1=warning, 2=critical,3=unknown state)

Have fun, Jorgen

Thank you! That is very helpful. Setting up a Nagios server is probably too much, but maybe I can use it by some other means which I will figure out.

If you don’t want to install nagios, use bash:
[[ $(curl -Ss "") == "\"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.

Cheers, Bernie_O

Perfect, that did the trick!
Thanks alot to both of you.