Blog of an Open Mind

Open Minded Thinking from the Open Minded Solutions team…

Blog of an Open Mind header image 2

Cleaning the /tmp partition

March 25th, 2010 · No Comments

If you have a server running Centos or most other flavours of Linux or you use cPanel/WHM for your box, you will often find that the /tmp partition slowly gets full over time and will eventually get clogged up. The net result of this is a reduction in the performance of your sites and in some cases, the server will grind to a halt.

It is good practice then to keep on top of this usage on a regular basis. Now before you dive in and just bin everything in the /tmp partition, be careful as often the mysql.sock file is in there if you run MySQL on the box and deleting that can cause you some fun.

The command below will safely clean your /tmp partition:

find /tmp -type f -mtime +5 -exec rm -f {} \;

Now just to break this down, the command is basically looking at the /tmp partition for files that are older than 5 days. The rm -f section means to force the removal of the file/directory (in this instance the file).

Stick the above command in a cron and run it say once a week and your /tmp partition should behave itself.

Tags: Tinterweb stuff

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

You must log in to post a comment.