mirror of
https://github.com/N0rthernL1ghts/wordpress.git
synced 2025-12-09 11:32:41 +01:00
Add healthcheck script and mechanism to make unhealthy if WP install integrity is compromised
This commit is contained in:
21
rootfs/usr/local/bin/healthcheck
Executable file
21
rootfs/usr/local/bin/healthcheck
Executable 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 $?
|
||||
Reference in New Issue
Block a user