35 lines
649 B
Bash
Executable File
35 lines
649 B
Bash
Executable File
#! /bin/sh
|
|
#
|
|
# 50-ansible-motd.sh
|
|
# Copyright (C) 2020 Vintage Salt <rehashedsalt@cock.li>
|
|
#
|
|
# Distributed under terms of the MIT license.
|
|
#
|
|
|
|
# Service statuses
|
|
if command -v systemctl > /dev/null 2>&1; then
|
|
len=20
|
|
printf "Services:\n"
|
|
for unit in \
|
|
9iron-backup \
|
|
ansible-pull
|
|
do
|
|
systemctl status $unit > /dev/null 2>&1
|
|
case $? in
|
|
0)
|
|
printf " * %-${len}.${len}s\e[32mRunning\e[0m\n" $unit
|
|
;;
|
|
1|2)
|
|
printf " * %-${len}.${len}s\e[31mDead\e[0m\n" $unit
|
|
;;
|
|
3)
|
|
printf " * %-${len}.${len}s\e[34mExited\e[0m\n" $unit
|
|
;;
|
|
*)
|
|
printf " * %-${len}.${len}s\e[33mUnknown\e[0m\n" "$unit"
|
|
;;
|
|
esac
|
|
done
|
|
fi
|
|
|