Files
addy.io/healthcheck.sh
T

5 lines
359 B
Bash

#!/bin/sh
set -eu
curl --fail --silent --show-error --max-time 8 --output /dev/null http://127.0.0.1:8000/login
php -r '$s = @fsockopen("127.0.0.1", 25, $errno, $errstr, 3); if (!$s) exit(1); stream_set_timeout($s, 3); $banner = fgets($s); $ok = is_string($banner) && strncmp($banner, "220 ", 4) === 0; fwrite($s, "QUIT\r\n"); fclose($s); exit($ok ? 0 : 1);'