Wednesday, June 1, 2011

How To Clear /tmp For Over Period Of Time

You may need to use a command called tmpwatch which removes files which haven’t been accessed for a period of time. Normally, it’s used to clean up directories which are used for temporary holding space such as /tmp.

Following code will remove all files/dirs from /tmp if they are not accessed in last 2 weeks (24 * 14 days = 336)

Code:
tmpwatch --mtime --all 336 /tmp

You can also add this command to the crontab.

No comments:

Post a Comment