Skip to content

Instantly share code, notes, and snippets.

@sparanoid
Last active February 24, 2018 20:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sparanoid/abb6e26d968accef9aa2 to your computer and use it in GitHub Desktop.
Save sparanoid/abb6e26d968accef9aa2 to your computer and use it in GitHub Desktop.
Speedtest.net Auto Update Script
#!/usr/bin/env bash
# Speedtest.net Auto Update Script
# Usage: Download the latest SpeedTest script monthly as in 1st of every month at 00:00
# 0 0 1 * * nice -n 19 bash /srv/www/speedtest.sh >/dev/null 2>&1
# Make sure speedtest.sh is executable
# chmod +x /srv/www/speedtest.sh
DES_PATH=/usr/share
PUB_PATH=/srv/www/speedtest.tokyo.sparanoid.com/public_html
ST_DIR=speedtest
wget http://c.speedtest.net/mini/mini.zip -O $DES_PATH/$ST_DIR.zip --limit-rate=200000k
unzip -o $DES_PATH/$ST_DIR.zip -d $DES_PATH/$ST_DIR
# Remove old public files
rm -rf $PUB_PATH/$ST_DIR
# Link from private directory to $ST_DIR in public directory
ln -sf $DES_PATH/$ST_DIR/mini $PUB_PATH/$ST_DIR
# Rename index-php.html to index.php
mv $DES_PATH/$ST_DIR/mini/index-php.html $DES_PATH/$ST_DIR/mini/index.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment