Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
procmail calling Perl, making a system call?
Results 1 to 10 of 10

Thread: procmail calling Perl, making a system call?

  1. #1

    procmail calling Perl, making a system call?

    Hello - I'm fairly new to procmail, but I've had success at setting up a procmailrc, and a .forward file. I have it set up so that procmail will call a Perl script, which extracts some attachments, etc. off the email and save them in a directory on the filesystem.

    The next step I'd like to do is analyze the recently extracted file. For example, if the file is a .tar file, I'd like to make a system call to "tar tvf <fname>" along these lines:

    $cmd = "tar tvf /full/path/to/attachment.tar";
    $output = `$cmd`;

    The problem is that the system call seems to result in no output when the Perl script it called by procmail. When I print the command to the screen and execute it by hand in the terminal window, it works fine. When I run the Perl script directly (without procmail in the middle) it produces expected output as well. But when procmail calls the perl script, the result of system call is empty. Are there restrictions as to what procmail-initiated programs can do via system calls, etc?

    I did a fair amount of seaching and couldn't find the answer. I'd appreciate any help you can provide. Thanks a lot!

    --daroo

  2. #2
    Junior Member tuxette's Avatar
    Join Date
    Jan 2006
    Posts
    60
    It could be an ownership and permissions problem on the perl script. If you are editing as root, but procmail is running as an unprivileged user you could get a problem when the mail enters through the normal channel.

  3. #3
    I was wondering about that. I am not root when I am editing or testing the script - I'm just my usual non-privileged user self. When procmail executes the script, what user is used? WHen I look at the files that the script creates with "ls -l" it lists the user as my user account, so it seems like the permissions should be fine, unless there are some inherent rules about permissions when running through procmail or something?

  4. #4
    Junior Member tuxette's Avatar
    Join Date
    Jan 2006
    Posts
    60
    Who is the owner of the .procmailrc file using?:

    Code:
    # ls -al
    The permissions on that file could be the problem too.

  5. #5
    My own user account is the owner of the .procmailrc file. The permissions are 0600. Perhaps that's the problem? Do the permissions of the file somehow determine what procmail scripts are allowed to do? I looked on the web and couldn't find anything about this, but I could have missed something. Thanks for your continued help.

  6. #6
    Junior Member tuxette's Avatar
    Join Date
    Jan 2006
    Posts
    60
    It's probably the syntax of the commands inside the .procmailrc file that is giving the problem.

  7. #7
    The .procmail script is pretty simple, but I am certainly no expert with procmail. Here's my script - all it does is copy emails containing the string "STUFF 4" into a file named "IN-p4stuff", then run the perl script in /home/daroo/processP4Stuff.pl. This perl script is the one that attempts to do a system call, but the system call seems to be "skipped over" - no obvious errors, but it just doesn't have the effect. As an example, I initially had a system call to "cp" to copy a file - but the copy never happened. However, when I changed it to use perl's "copy" function, the copy worked fine.

    Here's my simple .procmailrc - anythign jump out as being a problem? Thanks again for your help.

    :0
    * ^Subject:.*(STUFF 4 )
    {
    :0 c
    IN-p4stuff
    :0
    | /home/daroo/processP4Stuff.pl
    }

  8. #8
    Administrator Advisor peter's Avatar
    Join Date
    Apr 2004
    Posts
    882
    Sometimes with perl's "system" command you have to specify the full path to the binary file. /bin/cp instead of just cp.

    So does procmail work now? I'm not an expert either. Instead of creating the file and then piping it, how about just doing the pipe directly? Try it without the subject line test too and troubleshoot it that way.

    I've tested perl with emails and you have to cat the email file and pipe it through the perl script, which it sounds like you are doing. With procmail, the pipe is embedded in the .procmailrc file, which looks like what you have. I'd try it one step at a time. Test the pipe, test the subject line and the pipe, test the subject line, pipe and file creation.

    My sites:
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
    -
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

  9. #9
    Hey Peter - great suggestion - I didn't even think of that. That seemed to take care of it! Thanks so much - this has been driving me crazy. Without the full path, the systam call has no effect, but with the full path, everything works as expected. Hopefully this thread can help someone else who has the same problem at some point. Thanks again!

  10. #10
    Administrator Advisor peter's Avatar
    Join Date
    Apr 2004
    Posts
    882
    You're welcome!. I think you can use this too:

    Code:
    | $HOME/processP4Stuff.pl

    My sites:
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
    -
    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Similar Threads

  1. perl system mail
    By svar in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 02-08-2009, 05:19 AM
  2. Procmail Help
    By sk_kgs in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 06-30-2008, 08:26 AM
  3. Fetchmail + Procmail
    By ziajee in forum Linux - General Topics
    Replies: 0
    Last Post: 06-09-2004, 05:59 AM
  4. PERL: system and grabbing STDOUT
    By Blaqb0x in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 05-14-2003, 07:14 PM
  5. Great Article on Making a System Restore CD
    By stryder144 in forum Linux - General Topics
    Replies: 0
    Last Post: 01-24-2003, 08:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •