2016-07-07 20:28:16 +02:00
|
|
|
#!/bin/bash
|
2016-05-02 09:29:00 +02:00
|
|
|
|
|
|
|
comma=1
|
|
|
|
echo -n "{\"data\":["
|
|
|
|
|
2016-07-07 20:28:16 +02:00
|
|
|
if [ -e /san/mysql-fs/mysql ]; then
|
|
|
|
path="/san/mysql-fs/mysql/"
|
|
|
|
else
|
|
|
|
path="/var/lib/mysql/"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
for i in $(sudo /bin/find $path -type f -printf %p+%s= | tr "=" "\n" | grep -v "\/mysql\/mysql\/" | grep "\.ibd" | cut -d "+" -f 1 | sed 's/@002d/\-/g' | cut -d "/" -f 5- | sed 's/.ibd//g' ); do
|
2016-05-02 09:29:00 +02:00
|
|
|
|
|
|
|
dbname=$(echo $i | cut -d '/' -f 1)
|
|
|
|
tblname=$(echo $i | cut -d '/' -f 2)
|
|
|
|
|
|
|
|
if [ $comma -eq 0 ]; then
|
|
|
|
echo -n ","
|
|
|
|
fi
|
|
|
|
comma=0
|
|
|
|
echo -n "{\"{#DBNAME}\":\"$dbname\",\"{#TABLENAME}\":\"$tblname\"}"
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
echo -n "]}"
|