Program written in Go to perform simple file download to calculate download speed.
When the program is executed, it appends the download data to a file (speedtest.csv) in CSV format.
The CSV column data is:
- time of file download
- total bytes downloaded
- total megabytes downloaded
- total milliseconds to complete download
- total seconds to complete download
- speed of download in megabits/second (Mbps)
- speed of download in megabytes/second (MBps)
- go get github.com/adrianh-za/go-simple-speedtest
- browse to $/go/src/github.com/adrianh-za/go-simple-speedtest
- go run main.go
The following cron job runs every 4 hours. The cron job has multiple steps:
- 0 */4 * * * = Run every 4 hours.
- PATH=$PATH:/usr/local/go/bin = Set the path to include GO executable location.
- cd /home/pi/go/src/github.com/adrianh-za/go-simple-speedtest = Change the current directory to where the main.go file resides.
- go run main.go = Run the program.
- >> cron.txt 2>&1 = Dump output from cron job to this file (in the directory we changed to above) and don't mail output.
0 */4 * * * PATH=$PATH:/usr/local/go/bin && cd /home/pi/go/src/github.com/adrianh-za/go-simple-speedtest && go run main.go >> cron.txt 2>&1