Wednesday, July 09, 2008

automating mysqltuner

I found the mysqltuner a while back and had been using it on one of my servers sporadically. I suddenly thought... why don't I run it automatically via a cron every week and test the server optimisation. Easy...
sudo -s
chmod +x
cp ./ to /usr/local/bin/mysqltuner
Ensure that it's in the right place by running it and then optimise the current mysql server and restart it:
joe /etc/mysql/my.cnf
/etc/init.d/mysql restart
Now we need to add a cron entry to make it run every week.
crontab -e
43 4 * * * thur mysqltuner
And that's it, saving the crontab file will install it and on the next thursday at 4:43 in the morning, the optimiser will run as root and email the server admin the output.

No comments: