This post originally featured on the Echo & Co. blog.
Today I was made aware of some strange MySQL errors on our development server that ended up being related to a lack of sufficient disk space. Upon inspection, the /tmp partition had completely filled up. A majority of the files were temporary files created by the Drupal module devel with devel_themer enabled. Turns out these temporary files are not deleted at the end of a session. There were also CURLCOOKIE files related to cron jobs to hit cron.php on various dev and production sites, and some other temporary files that if left unattended could result in the same errors.
My solution is to have these files deleted every night, but only if they’re three days old, which should be adequate time for the developer to need access to these temporary files. I added this to root’s cron.
1 2 3 4 5
Similarly, I have a cron job to remove old Apache logs, which is helpful since an old project will never have it’s logs deleted unless they’re removed manually.
Do you have other ideas for managing temporary files that don’t clean up after themselves? Let me know in the comments.