execution_time_and_notify
This is an old revision of the document!
Check execution time and notify if exceed
#!/bin/bash # Monitor execution of process export receipients="status@k2.com" output=".BxJ04o1k2lcTURK" notify(){ for n in $receipients; do echo $1 | /usr/bin/mail -s "[Degree] `hostname` Time is More then 10 second" done } cd /usr/www/virtual/sf/www.xyz.com/ /usr/bin/time -h -p -o $output /usr/local/bin/php index.php >/dev/null 2>&1 count=0 for i in `cat $output | awk '{print $2}'` do case=`echo "$i > 10.0" | bc` if [ $case -eq '1' ] then count=1; fi done if [[ count -eq '1' ]] then notify "index.php is taking more then 10 second to execute" fi rm $output
execution_time_and_notify.1305085950.txt.gz · Last modified: 2020/08/10 02:28 (external edit)