User Tools

Site Tools


creating_the_speedtest_image_every_day

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
creating_the_speedtest_image_every_day [2025/01/16 23:06] stevecreating_the_speedtest_image_every_day [2026/04/01 15:20] (current) steve
Line 8: Line 8:
 <code bash SpeedTest> <code bash SpeedTest>
 #!/bin/bash #!/bin/bash
-/usr/local/bin/SpeedTest+~/bin/SpeedTest
 # Quick and simple log file of connection speed tests # Quick and simple log file of connection speed tests
 # SRJ 2016-12-26 # SRJ 2016-12-26
 # In crontab; # In crontab;
-09 */6 * * * /usr/local/bin/SpeedTest+*/6 * * * /usr/local/bin/SpeedTest
 YM=$(date +%Y-%m) ; MT=$(date -d "+6 hours" +%Y-%m) YM=$(date +%Y-%m) ; MT=$(date -d "+6 hours" +%Y-%m)
 Log=~/.SpeedTest.log Log=~/.SpeedTest.log
-ARG1="/var/www/html/SpeedTest" +ARG1="/var/lib/nethserver/vhost/e69822c467b3c73/SpeedTest" 
-ARG2="/var/www/html/${YM}-SpeedTest"+ARG2="/var/lib/nethserver/vhost/e69822c467b3c73/${YM}-SpeedTest"
 PLog=~/.PlotLog PLog=~/.PlotLog
 Date=$(date +"%Y-%m-%d %H:%M") Date=$(date +"%Y-%m-%d %H:%M")
-Data=($(/usr/local/bin/fast -u --json | grep -E 'latency|downloadSpeed|uploadSpeed' | cut -d : -f 2 | tr -d ',' | tr -d '\n' ; echo "")) +Data=($(/usr/local/bin/fast -u --json | grep -E 'latency|downloadSpeed|uploadSpeed' | cut -d : -f 2 | tr -d ',' | tr -d '\n' ; echo ""))  
-FData="${Data[2]} ${Data[0]} ${Data[1]}"+FData="${Data[2]} ${Data[0]} ${Data[1]}"  
 +# Data=$(/usr/bin/speedtest-cli --secure --simple | cut -d" " -f2 | tr '\n' ' ') 
 +# Data=${Data%?}
 echo "${Date} ${FData}" >> ${Log} echo "${Date} ${FData}" >> ${Log}
 +# echo "${Date} ${Data}" >> ${Log}
 tail -128 ${Log} > ${PLog} tail -128 ${Log} > ${PLog}
-/usr/local/bin/PlotSpeedTest +/usr/local/bin/PlotSpeedTest  
-if [ ${YM} != ${MT} ] +if [ ${YM} != ${MT} ]  
-        then + then  
-        cp ${ARG1}.png ${ARG2}.png + cp ${ARG1}.png ${ARG2}.png 
-        fi+ fi
 </code> </code>
  
Line 34: Line 37:
 <code gnuplot PlotSpeedTest> <code gnuplot PlotSpeedTest>
 #!/usr/bin/gnuplot #!/usr/bin/gnuplot
-# # /usr/local/bin/PlotSpeedTest+# #~/bin/PlotSpeedTest
 # # SRJ 2016-12-26 # # SRJ 2016-12-26
 fmt = '%Y-%m-%d %H:%M';        # Format used for printing out time fmt = '%Y-%m-%d %H:%M';        # Format used for printing out time
Line 47: Line 50:
 set format x "%b-%d" set format x "%b-%d"
 set xtics rotate set xtics rotate
-set xlabel "Time, tics are daily, samples are every six hours (09 */6 * * *)...\nTested using Sindre Sorhus' fast-cli."+set xlabel "Time, tics are daily, samples are every six hours (09 */6 * * *)...\nTested using Sindre Sorhus' fast-cli." 
 set autoscale y set autoscale y
 set autoscale xfix set autoscale xfix
Line 58: Line 61:
  
 set output "/dev/null" set output "/dev/null"
-plot '/root/.PlotLog' using 1:4+plot '/root/.PlotLog' using 1:4 
 max_Dn = GPVAL_DATA_Y_MAX max_Dn = GPVAL_DATA_Y_MAX
 min_Dn = GPVAL_DATA_Y_MIN min_Dn = GPVAL_DATA_Y_MIN
  
-plot '/root/.PlotLog' using 1:5+plot '/root/.PlotLog' using 1:5 
 max_Up = GPVAL_DATA_Y_MAX max_Up = GPVAL_DATA_Y_MAX
 min_Up = GPVAL_DATA_Y_MIN min_Up = GPVAL_DATA_Y_MIN
  
-plot '/root/.PlotLog' using 1:3+plot '/root/.PlotLog' using 1:3 
 max_Dl = GPVAL_DATA_Y_MAX max_Dl = GPVAL_DATA_Y_MAX
 min_Dl = GPVAL_DATA_Y_MIN min_Dl = GPVAL_DATA_Y_MIN
  
-set output "/var/www/html/SpeedTest.png"+set output "/var/lib/nethserver/vhost/e69822c467b3c73/SpeedTest.png"
 plot \ plot \
 '/root/.PlotLog' using 1:4 title sprintf("Download, Mbs, Max:%g Min:%g",  max_Dn, min_Dn ) with lines ls 1, \ '/root/.PlotLog' using 1:4 title sprintf("Download, Mbs, Max:%g Min:%g",  max_Dn, min_Dn ) with lines ls 1, \
creating_the_speedtest_image_every_day.txt · Last modified: by steve