Fix for: /usr/local/vesta/func/db.sh: line 390: [: : integer expression expected

Every night cron is sending email with subject: Cron <admin@host> sudo /usr/local/vesta/bin/v-update-sys-queue disk
And content of that email is: /usr/local/vesta/func/db.sh: line 390: [: : integer expression expected

This is a fix for that bug.

I guess mysql for some databases returns empty string for DB size, so this will handle that case.
This commit is contained in:
dpeca 2016-07-21 02:27:51 +02:00 committed by GitHub
commit 5d6c0137c1

View file

@ -387,7 +387,7 @@ get_mysql_disk_usage() {
query="SELECT SUM( data_length + index_length ) / 1024 / 1024 \"Size\"
FROM information_schema.TABLES WHERE table_schema='$database'"
usage=$(mysql_query "$query" |tail -n1)
if [ "$usage" == 'NULL' ] || [ "${usage:0:1}" -eq '0' ]; then
if [ "$usage" == '' ] || [ "$usage" == 'NULL' ] || [ "${usage:0:1}" -eq '0' ]; then
usage=1
fi
export LC_ALL=C