Tuesday, May 17, 2011

Regular temp cleaning

If the temp directory gets pretty big, it can slow down your system or you can have insufficient space on your harddisk. Therefore is good to clean temporary files from time to time.

There is one handy utility to handle this: tmpwatch
Usage is following: tmpwatch --mtime --all 336 /tmp, this command removes all files from temp which are older than 336 hours.

You can put this command in the crontab file, to be executed automatically at the specified time. Run the command crontab -l and insert the following line: 0 0 1 * * tmpwatch --mtime --all 336 /tmp, this will remove files from temp at the first day of each month.


Note: you can run crontab -l as root user, to have permissions to clean all files from temp.

No comments:

Post a Comment