scratch disk

Create a 'scratch' directory where users can place their temporary data with no harm, and after 30 days, any file will automagically disappear...

How to

  1. Create a directory under /home, say /home/scratch.
  2. Make it read-writeable by the users group (or any more privileged group, if it suits).
  3. In /etc/profile export an environment variable such as export SCRATCH=/home/scratch.
    Make sure that from this point on, any user-made script that needs working on the scratch directory refers to it using the $SCRATCH environment variable and not the explicit path (/home/scratch). Advantages: i) any user can refer to the 'scratch space' even without knowing where it really is, and ii) this helps a lot in shell scripts referring to the scratch disk whenever the real directory should change...

Now, it's time to set up the 'cleanser', of course with cron:
I use a one-liner sh script placed in /usr/local/sbin/purge_scratch, chmoded 0700, whose content is: find /home/scratch/* -mtime +30 -exec rm -f {} \;.
As you prefer, the one-liner can be directly placed in a crontab row.
Be careful not to use $SCRATCH here, since cron shell doesn't have bash environmental variables exported for granted, and $SCRATCH/* would expand to /*... which can lead to rather nasty thingies :). You've been warned...
Finally, call crontab -e and add a call to the script, say, every night half an hour before any backup script runs... or is it better after?