From c29cb968d77be0019f39ae7492cd4fb1cff429ef Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 12 Jan 2019 15:08:44 +0100 Subject: [PATCH] add color --- script/script/check_service.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/script/script/check_service.sh b/script/script/check_service.sh index b715a37..8e21912 100755 --- a/script/script/check_service.sh +++ b/script/script/check_service.sh @@ -1,14 +1,20 @@ SERVICES=("mariadb" "nginx" "php-fpm" "gitea" "tt-rss" "named" "autofs" "rsyncd.socket") HOST=$(hostname) +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' echo "device $HOST have reboot curent status of critic service:" for service in ${SERVICES[@]} do status=$(systemctl is-active $service) - echo "$service is $status" + if [ $status = "inactive" ] 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 - + echo "" done