Should you need to dump mysql proccess list with cron here you can find a nice script to do it. Please feel free to use it on your server, if default mysql slow queries logging is not enough for your purposes.
#!/bin/bash # # Plugins-DA.NET (support@plugins-da.net)
# Written by Alex S Grebenschikov # Version: 0.3, 2014-07-04 # ############################################################## # RUN THIS SCRIPT MANUALY OR WITH CRON # */5 * * * * root /root/dump_mysql_processlist.sh # CONSIDER TO SAVE IN /root/ OR ANY OTHER DIRECTORY ############################################################## ############################################################## # You may change SAVE_TO_DIR to any other value # which suits you the best ############################################################## SAVE_TO_DIR="/root/mysql_proclists/"; ############################################################## DIR="$SAVE_TO_DIR/$(date +%d)"; [ -d "$DIR" ] || mkdir -p $DIR; FILE="${DIR}/$(date +%H%M).dump"; MYSQLADMIN=""; if [ -x "/usr/local/mysql/bin/mysqladmin" ]; then MYSQLADMIN="/usr/local/mysql/bin/mysqladmin"; elif [ -x "/usr/local/bin/mysqladmin" ]; then MYSQLADMIN="/usr/local/bin/mysqladmin"; elif [ -x "/usr/bin/mysqladmin" ]; then MYSQLADMIN="/usr/bin/mysqladmin"; else echo "ERROR! mysqladmin was not found on the server!" exit 1; fi; $MYSQLADMIN \ --defaults-extra-file=/usr/local/directadmin/conf/my.cnf \ processlist \ --verbose=true >${FILE} 2>&1 exit 0;
Save it to /root/dump_mysql_processlist.sh and chmod it 700. Set a cron task to run it every 5 minute:
*/5 * * * * root /root/dump_mysql_processlist.sh
Please consider to have /usr/local/directadmin/conf/my.cnf with such a content (example):
[client] user=da_admin password=SECRET_PASS
Where SECRET_PASS should be replaced with a valid password taken from /usr/local/directadmin/conf/mysql.conf
Have fun with dumps which are stored for 30 days before they get overwritten.