Loading ...
Sorry, an error occurred while loading the content.
 

Single procmail filter file

Expand Messages
  • apdsf
    Hello I m a new user of Suse 9. Can someone tell me how to use just one .procmail file for all linux accounts. I already have one file for each user. Thanks.
    Message 1 of 5 , Apr 1, 2004
      Hello

      I'm a new user of Suse 9.
      Can someone tell me how to use just one .procmail file for all linux accounts.
      I already have one file for each user.
      Thanks.

      Paulo Ferreira
    • Aaron Kulkis
      ... copy your .procmail account to /etc/_procmail use the su command to become root, and then (using your favorite editor) $ su password make the following
      Message 2 of 5 , Apr 1, 2004
        apdsf wrote:
        > Hello
        >
        > I'm a new user of Suse 9.
        > Can someone tell me how to use just one .procmail file for all linux accounts.
        > I already have one file for each user.
        > Thanks.


        copy your .procmail account to /etc/_procmail

        use the su command to become root, and then (using your favorite editor)

        $ su
        password

        make the following script:

        #!/bin/bash
        # make links in user's home directories for a univeral .procmail file
        #
        # # turn on run-time tracing
        set -x

        SRC=/etc/_procmail

        # get user for normal users (exclude system accounts like root, bin, lp, mail ...)
        U_LIST=`awk -F: ' $3 >= 500 { print $1 } ' < /etc/passwd`

        for UNAME in $U_LIST
        do
        #
        HDIR=`echo ~$UNAME`
        cd $HDIR
        if [ ! -f .procmail ]
        then
        TGT=.$PROCMAIL
        ln -s /etc/${PROCMAIL} $TGT
        chown $USER $TGT
        fi
        done


        let's call it link_pm
        then, to make it executable:
        # chmod 755 link_pm

        and, run the script with

        # ./link_m
      • apdsf
        Next is the new file link_pm and below is the result of ./link_pm. Please tell me what s wrong. Thaks Paulo Ferreira #!/bin/bash # make links in user s home
        Message 3 of 5 , Apr 2, 2004
          Next is the new file "link_pm" and below is the result of ./link_pm.
          Please tell me what's wrong.
          Thaks

          Paulo Ferreira


          #!/bin/bash
          # make links in user's home directories for a univeral .procmail file
          #
          # # turn on run-time tracing
          set -x

          SRC=/etc/_procmail

          # get user for normal users (exclude system accounts like root, bin, lp, mail...)
          U_LIST=`awk -F: ' $3 >= 500 { print $1 } ' < /etc/passwd`

          for UNAME in $U_LIST
          do
          #
          HDIR=`echo ~$UNAME`
          cd $HDIR
          if [ ! -f .procmail ]
          then
          TGT=.$PROCMAIL
          ln -s /etc/${PROCMAIL} $TGT
          chown $USER $TGT
          fi





          linux:/etc # ./link_pm
          + SRC=/etc/_procmail
          ++ awk -F: ' $3 >= 500 { print $1 } '
          + U_LIST=nobody
          paufer
          metalo
          metalo2
          metalo3
          metalo4
          metalo5
          metalo6
          metalo7
          metalo8
          metalo9
          metalo10
          metalo11
          metalo12
          humberto
          lixo
          ./link_pm: line 23: syntax error: unexpected end of file
        • Aaron Kulkis
          ... Try this: I added a check for the existance of the user s directory #!/bin/bash # make links in user s home directories for a univeral .procmail file # # #
          Message 4 of 5 , Apr 2, 2004
            apdsf wrote:
            > Next is the new file "link_pm" and below is the result of ./link_pm.
            > Please tell me what's wrong.
            > Thaks
            >
            > Paulo Ferreira
            >
            >

            Try this: I added a check for the existance of the user's directory


            #!/bin/bash
            # make links in user's home directories for a univeral .procmail file
            #
            # # turn on run-time tracing
            set -x

            SRC=/etc/_procmail

            # get user for normal users (exclude system accounts like root, bin, lp, mail...)
            U_LIST=`awk -F: ' $3 >= 500 { print $1 } ' < /etc/passwd`

            for UNAME in $U_LIST
            do
            HDIR=`echo ~$UNAME`
            if [ -d $HDIR ]
            then
            cd $HDIR
            if [ ! -f .procmail ]
            then
            TGT=.$PROCMAIL
            ln -s /etc/${PROCMAIL} $TGT
            chown $USER $TGT
            fi
            fi
            done
          • apdsf
            Hello Thanks for your help. This is the result of the script. I don t know if the result is what you expected to be but, it still not working. Please keep
            Message 5 of 5 , Apr 6, 2004
              Hello
              Thanks for your help. This is the result of the script.
              I don't know if the result is what you expected to be but, it still not working.
              Please keep helping me.
              Thanks.

              Paulo Ferreira

              linux:/etc # ./link_pm
              + SRC=/etc/_procmail
              ++ awk -F: ' $3 >= 500 { print $1 } '
              + U_LIST=nobody
              paufer
              metalo
              metalo2
              metalo3
              metalo4
              metalo5
              metalo6
              metalo7
              metalo8
              metalo9
              metalo10
              metalo11
              metalo12
              humberto
              lixo
              ++ echo '~nobody'
              + HDIR=~nobody
              + '[' -d '~nobody' ']'
              ++ echo '~paufer'
              + HDIR=~paufer
              + '[' -d '~paufer' ']'
              ++ echo '~metalo'
              + HDIR=~metalo
              + '[' -d '~metalo' ']'
              ++ echo '~metalo2'
              + HDIR=~metalo2
              + '[' -d '~metalo2' ']'
              ++ echo '~metalo3'
              + HDIR=~metalo3
              + '[' -d '~metalo3' ']'
              ++ echo '~metalo4'
              + HDIR=~metalo4
              + '[' -d '~metalo4' ']'
              ++ echo '~metalo5'
              + HDIR=~metalo5
              + '[' -d '~metalo5' ']'
              ++ echo '~metalo6'
              + HDIR=~metalo6
              + '[' -d '~metalo6' ']'
              ++ echo '~metalo7'
              + HDIR=~metalo7
              + '[' -d '~metalo7' ']'
              ++ echo '~metalo8'
              + HDIR=~metalo8
              + '[' -d '~metalo8' ']'
              ++ echo '~metalo9'
              + HDIR=~metalo9
              + '[' -d '~metalo9' ']'
              ++ echo '~metalo10'
              + HDIR=~metalo10
              + '[' -d '~metalo10' ']'
              ++ echo '~metalo11'
              + HDIR=~metalo11
              + '[' -d '~metalo11' ']'
              ++ echo '~metalo12'
              + HDIR=~metalo12
              + '[' -d '~metalo12' ']'
              ++ echo '~humberto'
              + HDIR=~humberto
              + '[' -d '~humberto' ']'
              ++ echo '~lixo'
              + HDIR=~lixo
              + '[' -d '~lixo' ']'
              linux:/etc #
            Your message has been successfully submitted and would be delivered to recipients shortly.