, sudo apt install speedtest-cli , speedtest-cli ,
, speedtest-logger , , #!/bin/bash , /usr/bin/speedtest --csv --bytes --server 14231 | /home/pete/bin/speedtest-cli/sp_converter.py ,
, sp-converter.py , , #!/usr/bin/env python , , import sys , import datetime , from decimal import getcontext, Decimal , , cvs_string = sys.stdin.read() , #cvs_string = 14231,Frontier,DQAtlanta, GADQ,2019-05-11T10:49:47.320767Z,373.3181428487046,29.294,26972260.613894735,2017273.2599525761,,216.227.25.158 , , items = cvs_string.split(DQ,DQ) , , download = Decimal(items7) / 1000000 , , if download < 15.00: , upload = Decimal(items8) / 1000000 , , def pretty_datetime(datetime_string): , pretty_date = datetime_string.rsplit(DQTDQ) , pretty_time = pretty_date1.rsplit(DQ.DQ) , return pretty_date0 + DQ DQ + pretty_time0 , , x = datetime.datetime.now() , , txt = DQDate and Time-> DQ + x.strftime(DQ%Y-%m-%d %H:%M:%SDQ) + DQ Download-> DQ + str(round(download,2)) + DQ mb/s DQ + DQUpload-> DQ + str(round(upload,2)) + DQ mb/sDQ + DQ\nDQ , , try: , f = open(DQ/home/pete/bin/speedtest-cli/speedtest.logDQ, DQaDQ) , f.write(txt) , except: , print(DQSomething went wrong when writing to the fileDQ) , finally: , f.close() , , ,