What's a good strategy for clearing /tmp and /var/tmp?

What's a good strategy for clearing /tmp and /var/tmp? Updated: 03/29/01


Run the below shell script from root's crontab:

#!/bin/sh
DAYS=7
DIRS="/tmp /var/tmp"
find $DIRS -depth -fsonly vxfs -fsonly hfs -atime +$DAYS \
-exec rm -rf {} \;

The -depth option ensures no directory is removed before its contents,
-fsonly options are to avoid attempting ttttttttto remove files beneath
NFS or
CDFS mountpoints that might exist.



Home
FAQ