From: James Bunton Date: Sat, 6 Jun 2020 14:21:36 +0000 (+0000) Subject: healthcheck fixes X-Git-Url: https://code.delx.au/monosys/commitdiff_plain/ded8bef42de4f3cf75e9bf8349e921c5ac86302b healthcheck fixes --- diff --git a/healthcheck/packages b/healthcheck/packages index 87c6917..a8cf23c 100755 --- a/healthcheck/packages +++ b/healthcheck/packages @@ -22,7 +22,7 @@ if is_debian; then aptorphan 1>&2 echo "# aptitude search ~U" - aptitude search ~U 1>&2 + aptitude search ~U 1>&2 || true fi if is_arch; then diff --git a/healthcheck/run-all b/healthcheck/run-all index 2d57d51..0cb46ff 100755 --- a/healthcheck/run-all +++ b/healthcheck/run-all @@ -7,7 +7,7 @@ set -eu cd "$(dirname "$(readlink -f "$0")")" for i in ./*; do - if [ "$i" != "$(basename "$0")" ]; then + if [ "$(basename "$i")" != "$(basename "$0")" ]; then if ! "$i"; then echo -e "\n^^ FAILED! $(hostname) $PRETTY_NAME -- $i ^^\n" exit 1 diff --git a/healthcheck/systemd-units b/healthcheck/systemd-units index 5eea874..8a6bc63 100755 --- a/healthcheck/systemd-units +++ b/healthcheck/systemd-units @@ -1,9 +1,9 @@ #!/bin/bash -if systemctl is-failed -q '*'; then - echo -e "# systemctl --failed" - systemctl --failed - exit 1 -else +if systemctl is-system-running > /dev/null; then exit 0 fi + +echo -e "# systemctl --failed" +systemctl --failed +exit 1 diff --git a/healthcheck/systemd-user-units b/healthcheck/systemd-user-units new file mode 100755 index 0000000..5f8a406 --- /dev/null +++ b/healthcheck/systemd-user-units @@ -0,0 +1,13 @@ +#!/bin/bash + +if systemctl --user is-system-running > /dev/null; then + exit 0 +fi + +if systemctl --user is-system-running 2>&1 | grep -q 'Failed to connect to bus'; then + exit 0 +fi + +echo -e "# systemctl --user --failed" +systemctl --user --failed +exit 1