LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-13-2011, 05:25 PM   #1
jjrowan
Member
 
Registered: Sep 2001
Location: New Jersey
Distribution: Red Hat, SuSE, CentOS and Ubuntu
Posts: 50

Rep: Reputation: 16
Procmail executing perl script


I have procmail parsing the subject line of incoming e-mail and depositing individual files in a folder that match the procmail recipe. I want to have that recipe spawn a perl script to parse the file to pull out specific information. I've googled this and found many examples but none of them work. One question everyone asks "Is the perl script is flagged executable"? Yes.

Here's the procmail recipe:

:0
* ^Subject: Cron <root@frontier> cd /home/rowan;./tunnelsetup.sh
{
LOGFILE=$HOME/charge.log
:0
charges/
| /home/rowan/billing.pl

:0
default

}

When it finds a matching inbound message it logs it correctly in the charge.log file, writes the message in charges/new/xxx but skips the /home/rowan/billing.pl script.

Anyone know why?
 
Old 01-13-2011, 07:06 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by jjrowan View Post
* ^Subject: Cron <root@frontier> cd /home/rowan;./tunnelsetup.sh
AFAIK this isn't a valid subject. Export the message in plain text and you'll see there's actually two headers that make up this line.


Quote:
Originally Posted by jjrowan View Post
When it finds a matching inbound message it logs it correctly in the charge.log file, writes the message in charges/new/xxx but skips the /home/rowan/billing.pl script.
Procmail has debug flags you can set to see how a message gets processed in detail. Try that. If you can't make head nor tail of it post it here.
 
Old 01-14-2011, 07:58 PM   #3
jjrowan
Member
 
Registered: Sep 2001
Location: New Jersey
Distribution: Red Hat, SuSE, CentOS and Ubuntu
Posts: 50

Original Poster
Rep: Reputation: 16
I didn't realize you could only have one action for each :0.
You can have multiple recipes within a branch.
I write the inbound e-mail to a temp file with the first piece of the evaluation, then the next recipe parses the temporary file.

:0
* ^Subject: Cron <root@frontier> cd /home/rowan/;./tunnelsetup.sh
{
VERBOSE=yes
TMPFILE=tmp$$

:0 ac:
$TMPFILE

:0 ah
| (/usr/bin/psibillingparm.pl $TMPFILE; echo "Tempfile was $TMPFILE";rm -f $TMPFILE)

}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error executing Perl/CGI script loftus49 Fedora 6 06-10-2010 03:41 AM
Executing perl script from all users login stg_in2009 Linux - Software 3 11-06-2009 01:16 AM
Executing Perl Script TalkingMarble Linux - Newbie 4 08-05-2008 08:33 AM
executing perl script through .forward file skverma_in Linux - Newbie 3 10-21-2004 07:24 AM
executing perl script through .forward file skverma_in Linux - General 0 10-18-2004 05:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration