HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   Website load time test (http://www.howtoforge.com/forums/showthread.php?t=62005)

admins 28th May 2013 18:07

Website load time test
 
Hi all
I want to monitor my loadtime of an website. If the loadtime is bigger than 30s the apache2 should restart.

For the loadtime found this:
Code:

(time wget -p --no-cache --delete-after www.linuxweblog.com -q ) 2>&1 | awk '/real/ {print $2}'
output
Code:

0m0.207s
How could I do the rest?
Thanks
admins

moegeler 13th June 2013 22:03

I don't know wich Linux Distri do you have but try some like this:

Code:

#!/bin/sh
VAR_TIME="$( TIMEFORMAT='%R';time (wget -p --no-cache --delete-after www.linuxweblog.com -q) 2>&1 1>/dev/null )"

float_test() {
    echo | awk 'END { exit ( !( '"$1"')); }'
}

float_test "$VAR_TIME > 30.000" && /etc/init.d/apache2 restart

save this as a shell file like monitor.sh an then make a cronjob for this...

I don't have tried it, so i don't know if it works...


All times are GMT +2. The time now is 16:44.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.