Move healthcheck and wp wrapper to src/wp-utils

This commit is contained in:
2024-05-19 21:04:27 +02:00
parent f86a28f3a6
commit 80d592cf97
2 changed files with 0 additions and 0 deletions

21
src/wp-utils/healthcheck Executable file
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 $?

3
src/wp-utils/wp Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
/usr/local/bin/wp-cli --allow-root --path="/var/www/html" "$@"