Website load time test

Discussion in 'Programming/Scripts' started by admins, May 28, 2013.

  1. admins

    admins Member HowtoForge Supporter

    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:
    (time wget -p --no-cache --delete-after -q ) 2>&1 | awk '/real/ {print $2}'
    How could I do the rest?
  2. smartbloggger

    smartbloggger New Member

    @ Admin what is the ideal time of loading a website.
  3. moegeler

    moegeler New Member

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

    VAR_TIME="$( TIMEFORMAT='%R';time (wget -p --no-cache --delete-after -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 an then make a cronjob for this...

    I don't have tried it, so i don't know if it works...
    Last edited: Jun 13, 2013

Share This Page