Add healthcheck script and mechanism to make unhealthy if WP install integrity is compromised

This commit is contained in:
2023-01-24 01:42:53 +01:00
parent fedfaeafc4
commit 64722d5b6c
2 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
function main() {
FULL_CHECK="${1:-false}"
if [ -f "/tmp/.wp-unhealthy" ]; then
echo "Error: WordPress health is compromised: $(cat "/tmp/.wp-unhealthy")"
return 1
fi
# If FULL_CHECK is not requested, site functionality check with curl is skipped
if [ "${FULL_CHECK}" = "false" ]; then
return 0
fi
curl -sSf --output "/dev/null" "http://localhost/"
return $?
}
main "${@}"
exit $?