Hello Friends, i have few .sh scripts in different directories (like shown below) which is checking status of different services and output status. Current script is not restarting services if its not up. I would like to add this extra check that if service is not up then restart so we don't have to go to individual dir and restart if something is not up. Any example would be helpful.
/script/test1/script1.sh
/script/test2/script2.sh
/script/test3/script3.sh
i believe i need to trick below piece of code to add logic ,
#example for script-1
SCRIPT_DIR=/script/test1
SCRIPT_LOG=/script/logs
SCRIPT_CONTEXT="NULL"
if [ -x "$SCRIPT_DIR/script1.sh"]
then
{
start_script1;
if ["$?" -eq 0 ] ;
then $Logmsg "service1_is_up";
else $Logmsg "service1_is_down";
fi;
}
else
{
$Logmsg "$service1_script_access"
$Logmsg "$service1_is_down"
}
fi
/script/test1/script1.sh
/script/test2/script2.sh
/script/test3/script3.sh
i believe i need to trick below piece of code to add logic ,
#example for script-1
SCRIPT_DIR=/script/test1
SCRIPT_LOG=/script/logs
SCRIPT_CONTEXT="NULL"
if [ -x "$SCRIPT_DIR/script1.sh"]
then
{
start_script1;
if ["$?" -eq 0 ] ;
then $Logmsg "service1_is_up";
else $Logmsg "service1_is_down";
fi;
}
else
{
$Logmsg "$service1_script_access"
$Logmsg "$service1_is_down"
}
fi
Last edited: