Skip to content

Instantly share code, notes, and snippets.

@kimar
Created June 15, 2014 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kimar/db989aebd289e6caee39 to your computer and use it in GitHub Desktop.
Save kimar/db989aebd289e6caee39 to your computer and use it in GitHub Desktop.
DigitalOcean Shutdown after exceeding 999 GB (Credit goes to: http://pastebin.com/2vXMBaSi)
#!/bin/bash
ax=`vnstat --oneline | awk -F ";" '{print $11}'`
if [[ "$ax" == *GiB* ]];
then
if [ $(echo "$(echo "$ax" | sed 's/ GiB//g') > 999"|bc) -eq 1 ]
then
shutdown -h now
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment