diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2018-12-11 18:10:48 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2018-12-11 18:10:48 +0300 |
commit | 8b0968b2054d3bb8d90b5ac056727f7c2ebeaed3 (patch) | |
tree | d03b70f693463fc836a8dbe4240424d2547530c8 /pkgs/check_systemd/check_systemd | |
parent | c4273035cf5876e3ba8ed2c6b492d31c2de290ee (diff) | |
download | nixsap-8b0968b2054d3bb8d90b5ac056727f7c2ebeaed3.tar.gz |
(* HUGE *) Use nixpkgs overlays
Diffstat (limited to 'pkgs/check_systemd/check_systemd')
-rwxr-xr-x | pkgs/check_systemd/check_systemd | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/check_systemd/check_systemd b/pkgs/check_systemd/check_systemd new file mode 100755 index 0000000..e668331 --- /dev/null +++ b/pkgs/check_systemd/check_systemd @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -euo pipefail + +readarray -t failed < <( systemctl show '*.service' \ + --state=failed --property=Names \ + | sed -r -n 's,Names=(.+)\.service,\1,p' \ + | sort + ) + +if [ ${#failed[@]} -ne 0 ]; then + printf -v list ', %s' "${failed[@]}" + printf 'WARNING: %s failed\n' "${list:2}" + exit 1 +else + echo "OK: no failed services" + exit 0 +fi + + |