User Tools

Site Tools


execution_time_and_notify

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision Both sides next revision
execution_time_and_notify [2011/05/11 03:52]
k2patel created
execution_time_and_notify [2011/05/11 13:45]
k2patel
Line 1: Line 1:
 ====== Check execution time and notify if exceed ====== ====== Check execution time and notify if exceed ======
 +One Liner
 +
 +<code bash>
 +s=`date +%s`; /​usr/​local/​bin/​php index.php ; e=`date +%s`; if [ $(( $e - $s )) -gt 10 ]; then /​usr/​bin/​mail -s "​[Degree] `hostname` Time is More then 10 second"​ ; fi
 +</​code>​
 +
 +Script
  
 <code bash> <code bash>
Line 11: Line 18:
 notify(){ notify(){
    for n in $receipients;​ do    for n in $receipients;​ do
-      echo $1 | /​usr/​bin/​mail -s "​[Degree] `hostname` Time is More then 10 second"​+      echo $1 | /​usr/​bin/​mail -s "​[Degree] `hostname` Time is More then 10 second" ​$n
    done    done
 } }
execution_time_and_notify.txt ยท Last modified: 2020/08/10 02:35 (external edit)