recipe_gentoo/recipes/recipe_check_services.sh

24 lines
687 B
Bash
Raw Normal View History

print_config_title 'CHECK SERVICES'
2019-03-24 15:56:17 +01:00
# Test services status
for service in ${SERVICES_TO_CHECK[@]};
do
echo -e "Check service status : ${BLUE}${service}${NC}"
# Check if service is started
/etc/init.d/${service} status &>/dev/null
# Return Code
RC=$?
# Service not started or error
if [ $RC -ne 0 ]
then
SERVICES_NOT_STARTED_OR_ERROR="${SERVICES_NOT_STARTED_OR_ERROR} ${service}"
echo -e "${RED}Service ${service} NOT STARTED or ERROR : check KO${NC}\n"
# Service started without error
else
echo -e "${GREEN}Service ${service} STARTED : check OK${NC}\n"
fi
done