26 lines
842 B
Bash
26 lines
842 B
Bash
|
echo "-------------------------------------------------"
|
||
|
echo -e "--------------- ${BLUE}CHECK SERVICES${NC} ------------------"
|
||
|
echo -e "-------------------------------------------------\n"
|
||
|
|
||
|
# 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
|