res=`echo"select count(1) from requests where creation_time < date_sub(current_timestamp(), interval $min minute) and status = 10" | mysql --host=cctreqs --user=treqsweb --database=treqsjobs | awk'!/count/ {print}'`
if[[${res}!="0"]]
then
echo"TReqS was restarted because there were $res requests not processed and they were created more that ${min} minutes ago." | mail -s"TReqS restarted due to problematic behaviour"$email