{"id":1807,"date":"2008-02-28T15:33:49","date_gmt":"2008-02-28T23:33:49","guid":{"rendered":"http:\/\/lee.org\/blog\/archives\/2008\/02\/28\/set-up-a-cron-job-to-optimize-databases-monthly\/"},"modified":"2008-02-28T15:35:53","modified_gmt":"2008-02-28T23:35:53","slug":"set-up-a-cron-job-to-optimize-databases-monthly","status":"publish","type":"post","link":"https:\/\/www.lee.org\/blog\/2008\/02\/28\/set-up-a-cron-job-to-optimize-databases-monthly\/","title":{"rendered":"Set up a cron job to optimize databases monthly"},"content":{"rendered":"<p>I set this up mostly because Spam Karma leaves <a href=\"http:\/\/lee.org\/blog\/2008\/01\/24\/repair-and-optimize-your-mysql-database-occasionally\/\">giant overhead<\/a> in my WordPress MySQL database. But it can&#8217;t hurt running it on the rest of my databases.<\/p>\n<p>My cron job, which runs at 6:05am every first of the month looks a bit like this<br \/>\n<code>#!\/bin\/sh<br \/>\n# Optimize all of my popular databases. This is run from a cron job monthly or so.<br \/>\necho -n \"Started database optimization at \";\/bin\/date; echo -e \"\\n\\n\";<br \/>\n\/usr\/bin\/mysqlcheck -o -v -u user -ppassword -h mysql.lee.org blogdatabase;<br \/>\necho -e \"Finished blogdatabase\\n\\n\";<br \/>\n\/usr\/bin\/mysqlcheck -o -v -u otheruser -potherpw -h mysql.lee.org otherdatabase;<br \/>\necho -e \"Finished gallerydatabase\\n\\n\";<br \/>\necho -n \"Finished database optimization at \";\/bin\/date; echo -e \"\\n\\n\";<\/code><\/p>\n<p>I get a monthly email with the output that I can look over.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I set this up mostly because Spam Karma leaves giant overhead in my WordPress MySQL database. But it can&#8217;t hurt running it on the rest of my databases. My cron job, which runs at 6:05am every first of the month looks a bit like this #!\/bin\/sh # Optimize all of my popular databases. This is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1807","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts\/1807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/comments?post=1807"}],"version-history":[{"count":0,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts\/1807\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/media?parent=1807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/categories?post=1807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/tags?post=1807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}