-
-
Save taidos/8e56c181bab571a24d6b29070a51010f to your computer and use it in GitHub Desktop.
This file contains 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 | |
MYSQL=`which mysql` | |
MYSQLUSER=root | |
MYSQLPASSWD=`grep ^mysql= /usr/local/directadmin/scripts/setup.txt|cut -d'=' -f2` | |
MYSQLHOST=localhost | |
DST=/var/spool/mysqlsfp | |
DST=$DST/`date +%Y-%m-%d` | |
mkdir -p $DST | |
cd `dirname $0` | |
FN=`date +%Y.%m.%d-%k:%M:%S` | |
OP="select concat('========================================== ',now(),' =============================================') as date;show full processlist;" | |
SLOP="select sleep(10);" | |
LC_MESSAGES=ru_RU.UTF-8 | |
LC_COLLATE=ru_RU.UTF-8 | |
LANG=ru_RU.UTF-8 | |
export LC_MESSAGES LC_COLLATE LANG | |
$MYSQL -u${MYSQLUSER} -p${MYSQLPASSWD} -h${MYSQLHOST} -NBe "${OP}${SLOP}${OP}${SLOP}${OP}${SLOP}${OP}${SLOP}${OP}${SLOP}${OP}" 2>&1| gzip -c > $DST/${FN}.gz | |
find $DST -mtime +30 -delete | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment