Skip to content

Instantly share code, notes, and snippets.

@stuudmuffin
Last active January 23, 2018 17:04
Show Gist options
  • Save stuudmuffin/d94b7d9bb1d57eef455863addddd8ea5 to your computer and use it in GitHub Desktop.
Save stuudmuffin/d94b7d9bb1d57eef455863addddd8ea5 to your computer and use it in GitHub Desktop.
Script to easily show how much storage your minecraft dynamp is using
#!/bin/bash
host="127.0.0.1"
db="dynmap"
user="db_user_name"
pass="db_user_pass"
## an alternative to putting the password into the script ( "less secure" ) is to read the user input into the variable ( "more secure" ).
#echo "Enter password for $user: "
#read -s pass
#database sizes
dbsize=$(mysql -u $user -h $host -p$pass -se 'SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables WHERE table_schema = "'$db'";');
echo $dbsize;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment