procmail
[Top] [All Lists]

Re: Folder test/create problem

2002-07-07 14:45:46
Adam has,

|     SFAAPP = $HOME/web/gms/sfa/apps/`date +%y%m`
|
|     :0 a
|     {
|         :0 ic
|         * ? test ! -d $SFAAPP
|         | mkdir $SFAAPP;chmod 755 $SFAAPP
|
|         :0 c:
|         $SFAAPP
|
|         :0 c
|         | chmod 644 $SFAAPP/msg.*
|     }

and gets these results:

| Now, if the directory already exists, the message gets filed just
| fine. But if it has to create the directory, I get the following
| errors in my log and the message gets stored in a *file* named
| "0207."
|     mkdir: cannot create /users/sfc/web/gms/sfa/apps/0207: File exists
|     chmod: can't access /users/sfc/web/gms/sfa/apps/0207/msg.*

Bart has posited that perhaps $SFAAPP has already been created as an empty
plain file.  Another thing that crossed my mind was that, since the recipe
calling mkdir has no `w' nor `W' flag, procmail might be faster to move down
to the next recipe and create $SFAAPP as a plain file than mkdir is to create
it as a directory.

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
     }

If setting UMASK doesn't work and you must call chmod, I'd suggest referring
to the newly created file in the $SFAAPP directory by the $LASTFOLDER variable
rather than by trying to match a globbing pattern:

         dummyvariable=`chmod 644 "$LASTFOLDER"`




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