add color

This commit is contained in:
vincent 2019-01-12 15:08:44 +01:00
parent 563de6cb25
commit c29cb968d7

View File

@ -1,14 +1,20 @@
SERVICES=("mariadb" "nginx" "php-fpm" "gitea" "tt-rss" "named" "autofs" "rsyncd.socket") SERVICES=("mariadb" "nginx" "php-fpm" "gitea" "tt-rss" "named" "autofs" "rsyncd.socket")
HOST=$(hostname) HOST=$(hostname)
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
echo "device $HOST have reboot curent status of critic service:" echo "device $HOST have reboot curent status of critic service:"
for service in ${SERVICES[@]} for service in ${SERVICES[@]}
do do
status=$(systemctl is-active $service) status=$(systemctl is-active $service)
echo "$service is $status"
if [ $status = "inactive" ] if [ $status = "inactive" ]
then then
echo $(journalctl -u $service --lines=10 ) echo -e "${RED}$service is $status${NC}"
echo $(journalctl -u $service --lines=10 -q)
else
echo -e "${GREEN}$service is $status${NC}"
fi fi
echo ""
done done