Skip to content

Instantly share code, notes, and snippets.

@joesturge
Created June 10, 2022 18:31
Show Gist options
  • Select an option

  • Save joesturge/5c279297002240ad755573cb7348a053 to your computer and use it in GitHub Desktop.

Select an option

Save joesturge/5c279297002240ad755573cb7348a053 to your computer and use it in GitHub Desktop.
Script to run speedtest on asus merlin router and push results to a google form
#!/usr/bin/env bash
# Download and untar https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-aarch64.tgz
TIMESTAMP=$(date +%s)
echo running speedtest at $TIMESTAMP
RESULTS=$(/tmp/home/root/speedtest --format=csv | awk -F, '{print $3, $6, $7}' | sed 's/"//g' | awk '{print $1, $2/125000, $3/125000}');
PING=$(echo $RESULTS | awk '{print $1}');
DOWNLOAD=$(echo $RESULTS | awk '{print $2}');
UPLOAD=$(echo $RESULTS | awk '{print $3}');
echo ping: $PING;
echo download: $DOWNLOAD;
echo upload: $UPLOAD;
echo ;
echo saving results to online form...
curl --location --request POST '<form-url>/formResponse' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode entry.<download-field-id>=${DOWNLOAD} \
--data-urlencode entry.<upload-field-id>=${UPLOAD} \
--data-urlencode entry.<ping-field-id>=${PING} \
--data-urlencode entry.<timestamp-field-id>=${TIMESTAMP} \
--silent > /dev/null;
echo speedtest complete!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment