Last active
February 24, 2018 20:09
-
-
Save sparanoid/abb6e26d968accef9aa2 to your computer and use it in GitHub Desktop.
Speedtest.net Auto Update Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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