bandwidth/bandwidth.sh

28 lines
589 B
Bash

#!/bin/bash
function writeMariaDB ()
{
echo "write data to mariadb"
mariadb-import --host server0 --user sascha -p527646 --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.1 by DJh2o2"
runTest
echo "Ready!"