feat(diagnostics): add read-only WireGuard health checks
This commit is contained in:
@@ -11,5 +11,17 @@ fi
|
||||
if [[ $# == 0 && "$allow_empty" == "$command_name" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
if [[ $# == 3 && $1 == is-active && $2 == -- && $3 == wg-quick@${WG_MOCK_INTERFACE:-wg0} ]]; then
|
||||
case ${SYSTEMCTL_STATE:-missing} in
|
||||
active|inactive|failed|unknown) printf '%s\n' "$SYSTEMCTL_STATE"; [[ $SYSTEMCTL_STATE == active || $SYSTEMCTL_STATE == unknown ]] && exit 0 || exit 3 ;;
|
||||
esac
|
||||
fi
|
||||
if [[ $# == 1 && $1 == is-system-running ]]; then
|
||||
case ${SYSTEMCTL_INIT:-missing} in
|
||||
running) printf '%s\n' "$SYSTEMCTL_INIT"; exit 0 ;;
|
||||
degraded) printf '%s\n' "$SYSTEMCTL_INIT"; exit 1 ;;
|
||||
*) printf '%s\n' "${SYSTEMCTL_INIT:-offline}"; exit 3 ;;
|
||||
esac
|
||||
fi
|
||||
printf 'Unexpected mock invocation: %s received arguments\n' "$command_name" >&2
|
||||
exit 99
|
||||
|
||||
Reference in New Issue
Block a user