#!/usr/bin/bash

CU='\033[4m'    # underline
C0='\033[0m'    # clear
C1='\033[31m'   # red
C2='\033[32m'   # green
C3='\033[33m'   # yellow
C4='\033[34m'   # blue

service () {
  unset STATUS
  if /usr/bin/systemctl is-active --quiet "${1}"; then
    STATUS="${C2}Active"
  elif /usr/bin/systemctl is-failed --quiet "${1}"; then
    STATUS="${C1}Failed"
  else
    STATUS="${C0}Inactive"
  fi
}

service 'dbus.service'
/usr/bin/echo -e "\t${C3}D-Bus:\t\t\t\t\t\t${STATUS}${C0}\t"
service 'ssh.service'
/usr/bin/echo -e "\t${C3}OpenBSD Secure Shell:\t\t\t\t${STATUS}${C0}\t"
service 'systemd-journald.service'
/usr/bin/echo -e "\t${C3}Systemd (Journal):\t\t\t\t${STATUS}${C0}\t"
service 'systemd-logind.service'
/usr/bin/echo -e "\t${C3}Systemd (Login):\t\t\t\t${STATUS}${C0}\t"
service 'systemd-networkd.service'
/usr/bin/echo -e "\t${C3}Systemd (Network):\t\t\t\t${STATUS}${C0}\t"
