Skip to content

Instantly share code, notes, and snippets.

@JacobHayes
Created March 29, 2017 19:08
Show Gist options
  • Save JacobHayes/c5bf31d247c9137d53d238065b27647c to your computer and use it in GitHub Desktop.
Save JacobHayes/c5bf31d247c9137d53d238065b27647c to your computer and use it in GitHub Desktop.
Show failed systemd units on login - tweaked from coreos script (removed locksmithd check)
#/etc/profile.d/systemd_failed_units.sh
#
# Only print for interactive shells.
if [[ $- == *i* ]]; then
FAILED=$(systemctl list-units --state=failed --no-legend)
if [[ ! -z "${FAILED}" ]]; then
COUNT=$(wc -l <<<"${FAILED}")
echo -e "Failed Units: \033[31m${COUNT}\033[39m"
awk '{ print " " $1 }' <<<"${FAILED}"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment