procmail
[Top] [All Lists]

Re: set names for backup files

2002-06-27 09:04:39
On Tue, 25 Jun 2002, Jacques L'helgoualc'h wrote:

Vous avez écrit, le 06/25/02 à 18:10:29 :

[...]

    Try to make directory witch named by the date:

D=`date '+%m%d'`
:0 c
* ? mkdir -p /var/spool/backup.${D}
/var/spool/backup.${D}

:0 ic
| ls /var/spool/backup.* | head -36 | xargs rm -rf

 "head -36" != "sed -e 1,36d"

You can use "tail +37", but, IMHO, it is not useful erasing old backups
for each message.

        The trick here is that "%m%d" will make all the filenames in four
        characters (zero leading if needed).  It helps the ls(1) to give you
        the list of files sorted by date (:-)  Now, you need cut the HEAD of
        the list not tail.  You right there is a problem if you get no
        messages say, 30 days. in this case we will see:

yarkon# ls
0601
0602
0701
0702
...
        If we remove the first 36 files we are going to remove files from
        Jul too early - to avoid - you can touch the file from crontab at
        night.  You will get empty files for empty days.  In your case
        when size or other parameters included, the find(1) solution in
        much more efficient.

        BTW. I suppose that %y%m%d is better (happy new year..)

Bye,
 Udi

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>