I'm having a strange issue with running scripts (perl and ruby failing) from incoming mail locally delivered by procmail.
The system is CentOS 5.5 with postfix as my mailer, then a .forward set up to send email on to procmail. The .procmailrc and scripts are identical to a working setup on an Ubuntu server.
Here's the .procmailrc:
PATH= /usr/local/bin:/usr/bin:${PATH}
SHELL=/bin/bash
MAILDIR=$HOME/Maildir
DEFAULT=${MAILDIR}/
LOGABSTRACT=yes
LOGFILE=$HOME/Maildir/proclog
VERBOSE=YES
:0 wc
* ^To.*web@mydomain.com
| /home/web/perltest.pl
Here's the perl script:
#!/usr/bin/env perl
system("touch /home/web/touchedfile");
And then the failure in the log upon receiving email:
procmail: Executing "/home/web/perltest.pl"
/home/web/perltest.pl: line 3: syntax error near unexpected token `"touch /home/web/touchedfile"'
/home/web/perltest.pl: line 3: `system("touch /home/web/touchedfile");'
The line endings are all UNIX. The script runs fine from the command line.
The whole setup works fine if I pipe to procmail directly from the command line, but when it's invoked as part of the local delivery process, the #! line seems to be ignored in the script.
I can get the perl script to run if I explicitly execute perl in the pipe, like so:
:0 wc
* ^To.*web@mydomain.com
| perl /home/web/perltest.pl
... but I really don't want to admit defeat and do that.