procmail
[Top] [All Lists]

Re: Automatically Deleting Based on Date

1996-07-02 08:09:15
Hal Wine suggested to Brock Rozen,

| >Although I'm in AWE of David's solution, this really sounds like a job
| >for find, run by cron.

Thanks for the awe, Hal, but where does find come in?  It sounds more like a
job for rm, run by cron.

Just before midnight, rm $MAILDIR/PG/Backup-* (in such a way that rm's shell
knows the value of MAILDIR).

Given that, Brock wouldn't even need to include the date in the name, since
there would be only one backup file at a time.  He could name it just
$MAILDIR/PG/Backup and it would always hold only the current day's data.

Doug Hughes cautioned Hal,

| Except for the fact that that is insecure via race conditions that will allow
| someone to remove any file owned by the user running the find in many
| cases.
|  Be very very careful with this.. (find from cron - especially as root)

We don't need to use find anyway.  Just let the shell that cron invokes
expand a simple wildcard.