procmail
[Top] [All Lists]

Re: Folder test/create problem

2002-07-07 20:55:00
I suggested to Adam,

| > My first recommendation is this:
| >
| >    :0 a
| >    {
| >        :0 icw
| >        * ? test ! -d $SFAAPP
| >        | mkdir $SFAAPP && chmod 755 $SFAAPP
| >
| >        oldumask=$UMASK
| >        UMASK=022 # maybe 133?
| >
| >        :0ac:
| >        $SFAAPP
| >
| >        UMASK=$oldumask
| >    }

and he noticed that, because of the `a' flag on the save to $SFAAPP,

| Okay, this successfully creates the directory if it doesn't exist, files the
| first message, and sets the permissions. Any subsequent messages, however,
| don't get filed at all.

Right; I goofed with that `a' flag.  My goal was to try to save there only if
the directory had been safely created, forgetting about the case where it
already existed.  Sorry.  I think I'll take an old idea of Philip's here:

 :0 a
 {
  :0 # get name of bottommost element of $SFAAPP
  * SFAAPP ?? ()\/[^/]+^^
  { thismonth=$MATCH }

  oldumask=$UMASK
  UMASK=022

  :0c # no need to lock, is there? # thanks to PG for this trick
  $SFAAPP/../$thismonth

  :0eicw # if that didn't work, try mkdirring
  | mkdir $SFAAPP && chmod 755 $SFAAPP
   :0ac # and if you mkdirred and chmodded, save again
   $SFAAPP

  # if that didn't work either
  :0c: # drop second colon if safetybox is a premade directory
  * ! $ LASTFOLDER ?? $\SFAAPP/(.*/)?$\MSGPREFIX
  safetybox

  UMASK=$oldumask
 }

The $\variable constructions may not work in such an old version, though.
Just $variable ought to be OK in these particular cases.








_______________________________________________
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>