Parent document is top of "comp.sys.hp.hpux FAQ"
Previous document is "7.17 How can I make a ramdisk?"
Next document is "7.19 How can I change the timezone?"

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

Two suggestions (to be run from cron) are below. The first being the
optimal solution:

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

The -depth option ensures no directory is removed before its contents,
-fsonly hfs is because occasionally I've NFS-mounted stuff there and
it's better to do the clearing in the machine where it's local,
and -hidden is in case CDF's appear there for some reason.

(Thanks to Tapani Tarvainen and Michael Sternberg <mgs@po.cwru.edu>)


#!/bin/sh
DAYS=7
DIRS="/tmp /usr/tmp"
find $DIRS -type d -atime +$DAYS -exec rm -rf {} \;
find $DIRS ! -type d -atime +$DAYS -exec rm -f {} \;


(Thanks to Rich Jennings, HP and Michael Sternberg <mgs@po.cwru.edu>)

Parent document is top of "comp.sys.hp.hpux FAQ"
Previous document is "7.17 How can I make a ramdisk?"
Next document is "7.19 How can I change the timezone?"