Voici un petit script simple pour tester en ligne de commande le temps de réponse d’une page web.
Le script affichera les 3 temps suivants:
Time_Connect
Time_startTransfer
Time_total
speedtest.sh
#!/bin/bash
CURL=”/usr/bin/curl”
GAWK=”/bin/gawk”
URL=$1
result=`$CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $URL`
echo ” Time_Connect Time_startTransfer Time_total ”
echo $result | $GAWK -F: ‘{ print $1″ “$2” “$3}’
CURL=”/usr/bin/curl”
GAWK=”/bin/gawk”
URL=$1
result=`$CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $URL`
echo ” Time_Connect Time_startTransfer Time_total ”
echo $result | $GAWK -F: ‘{ print $1″ “$2” “$3}’
Utilisation
./speedtest.sh http://votre.site/page