bandwidth/bandwidth.sh

28 lines
575 B
Bash

#!/bin/bash
function writeMariaDB ()
{
echo "write data to mariadb"
mariadb-import --host 192.168.177.7 --user root -p"Lungretter1!" --local --fields-terminated-by=',' bandwidth speedtest.tmp
}
function runTest ()
{
# run speedtest against named server with csv output saved in tmp file
echo "running speedtest-cli"
speedtest-cli --secure --csv > speedtest.tmp
bat speedtest.tmp
# write output to db
writeMariaDB
# write output to csv
echo "write data to csv"
cat speedtest.tmp >> speedtest.csv
}
# main
echo "bandwidth V0.11 by DJh2o2"
runTest
echo "Ready!"