Created
June 15, 2014 15:42
-
-
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)
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
#!/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