recipe_gentoo/recipes/recipe_check_services.sh

24 lines
687 B
Bash
Executable File

print_config_title 'CHECK SERVICES'
# 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