Skip to content

Instantly share code, notes, and snippets.

@parndt
Created September 10, 2012 01:27
Show Gist options
  • Save parndt/3688311 to your computer and use it in GitHub Desktop.
Save parndt/3688311 to your computer and use it in GitHub Desktop.
Put Orcon Usage information in your OS X Terminal upon login
# Put this in your ~/.bash_profile down the bottom or somewhere
echo "Current usage: $(cat ~/.orcon_usage)"
# Install this into your crontab
# crontab -e
# Runs every 2 hours (*/2 is every alternate hour)
0 */2 * * * /bin/bash -c '. $HOME/.bashrc && ~/bin/update_orcon'
#!/bin/bash
# Returns current Orcon usage information
# Put in ~/bin/update_orcon
# Bonus points for improving the quickly hacked together grep/sed combo.
curl --silent http://www.orcon.net.nz/modules/usagemeter/view/usage.php | grep "Total Usage" -A 1 | grep "<dd>" | sed 's/<dd>//' | sed 's/<\/dd>//' | sed 's/\ *//g' | sed 's/ //' > ~/.orcon_usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment