Q:

How to make a script that execute a command when two parameters are similar for 5 minutes?

I'm using cURL to get some data from a website, so how to do to execute a command if two parameters from this website is the same for 5 minutes? 
#!/bin/bash

TIME= "300s"

abc=`$CURL ***
abcd=`$CURL *** 

echo $abc
echo $abcd 

if [ [ [ "$abc" -eq "eee" || "$abc" -eq "rrr" ] || [ "$abcd" -eq "eee" || "$abcd" -eq "rrr" ] ] -ge [ "$TIME" ] ] 
then
  echo "Critical hosts: "$abc
  echo "Critical service: "$abcd
fi

So if $abc and $abcd are == "eee" or == "rrr" for 5 minutes then do the command.

A:

Below the skeleton to your script. You will have to implement my_curl_function yourself, but I suggest to call the curl function once and parse the data for both SERVER and SERVICE. Calling it once for each variable brings a lot of overhead, which causes the loop not to be exactly 5 minutes (which it isn't already). If you really, really, really want it to be exactly 5 minutes, use Python ;-)
The script validates every second whether the content of SERVER or SERVICE is changed. If either one of them are different than what's expected, the loop will break and the script echoes "Data is changed". It will echo "Data remains unchanged" otherwise.
#! /bin/bash

function my_curl_function {
    echo "Implement me!"
}

MYTIME=300

SERVER_EXPECTED=$(my_curl_function)
SERVICE_EXPECTED=$(my_curl_function)
SERVER=""
SERVICE=""

CHANGED=0

for ((x=0; x<MYTIME;x++)); do

    SERVER=$(my_curl_function)
    SERVICE=$(my_curl_function)

    if [ "${SERVER_EXPECTED}" != "${SERVER}" ] || [ "${SERVICE_EXPECTED}" != "${SERVICE}" ]; then
        CHANGED=1
        break
    fi
    echo -ne "\rSeconds waiting: $x"
    sleep 1
done
echo

if [ ${CHANGED} -eq 1 ]; then
    echo "Data is changed"
    exit 0
else
    echo "Data remains unchanged"
    exit 1
fi

