Bug #1114 ยป treqs_joker.sh
| 1 |
#!/bin/sh
|
|---|---|
| 2 |
|
| 3 |
#------------------------------------------------------------------------------
|
| 4 |
# This script checks if TReqS has processed all the queries in the last n
|
| 5 |
# minutes.
|
| 6 |
# The scripts has not any parameters.
|
| 7 |
# To call this script:
|
| 8 |
# treqs_joker.sh
|
| 9 |
#
|
| 10 |
# Control Version
|
| 11 |
# Date Author Message
|
| 12 |
# 2010-12-02 gomez Creation script
|
| 13 |
#------------------------------------------------------------------------------
|
| 14 |
|
| 15 |
email=treqsmaster@cc.in2p3.fr |
| 16 |
min=30 |
| 17 |
|
| 18 |
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}'` |
| 19 |
if [[ ${res} != "0" ]] |
| 20 |
then
|
| 21 |
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 |
| 22 |
/etc/init.d/treqsd restart |
| 23 |
fi
|