LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-20-2004, 01:11 AM   #1
skverma_in
LQ Newbie
 
Registered: Oct 2004
Posts: 7

Rep: Reputation: 0
executing perl script through .forward file


Hello Everybody,

I am working on a proprietary UNIX environment. There's a user on that box which has his .forward file setup. But the thing is that this .forward file is setup not for forwarding the mails but for executing a perl script. Whenever a mail is sent to this user from anywhere it executes the perl scripts which parses the content of the mail and creates some files.
The content of the .forward file is :
------------------
"|/home2/certify/parsemail.pl NEWLIST"
------------------
As you can see it executes parsemail.pl with the parameter NEWLIST.
The problem is that I have been asked to replicate the entire environment now on Linux. But I am not able to replicate this behavior of .forward file in linux.
The .forward file does gets created but the script does not executes.It throws errors. I have searched google for help but to no avail.
I have been stuck here for quite some time now. Please help me out with your insights.

Thanks & Regards,
Sharad
 
Old 10-20-2004, 01:16 AM   #2
fblucher
Member
 
Registered: Oct 2004
Location: Australia
Distribution: NLD 9
Posts: 60

Rep: Reputation: 15
Give us the errors.

What mail program are you using? Some need to have support for .forward configured. You may find that procmail is more flexible in executing scripts on email aswell.

Seeya,
Finn.
 
Old 10-20-2004, 08:46 AM   #3
skverma_in
LQ Newbie
 
Registered: Oct 2004
Posts: 7

Original Poster
Rep: Reputation: 0
----- The following addresses had permanent fatal errors -----
"|/home2/certify/testmail.pl NEWLIST"
(reason: service unavailable)
(expanded from: testcertify@localhost)

----- Transcript of session follows -----
smrsh: testmail.pl not available for sendmail programs
554 5.0.0 Service unavailable
---------------------------------------------------------------------------

Hi,
Above is the error I recieved when I send mail to the user whose .forward file is setup. I found out that a link to the executing program needs to be setup in the /etc/smrsh directory. I did so. Now there is no error but I can see that the script still does not gets executed.
This 'certify' user is on a NFS mounted directory. In the above error line '/home2' is nfs mounted on our server. It's shell has been defined as one defined in the /etc/shells file as I was trying for some help out on google. It also said to include '/SENDMAIL/ANY/SHELL/' in the /etc/shells, i did it, but to no luck. The mail I send to this user reaches this user as we can see the mail file (/var/spool/mail/certify) for this user recieves it, but the .forward file should catch it and execute the script.

Anything I'm missing ?

Regards,
 
Old 10-21-2004, 07:24 AM   #4
skverma_in
LQ Newbie
 
Registered: Oct 2004
Posts: 7

Original Poster
Rep: Reputation: 0
Hi,
I found out that the user's home directory for which .forward file has been set up should not be group writeable. But in my case the user's home directory needs to be group writeable.
There is a 'DontBlameSendmail' option in Sendmail which needs to be set to 'ForwardFileInGroupWritableDirPath' which would then allow to execute scripts referred from within .forward file.
I don't know how to set this option in sendmail configuration file. This option is there in sendmail.cf file and this file is generated from sendmail.mc by executing the macro m4. It's said that sendmail.cf should not be manually edited.
Can anybody please let me know as to how do we set this option in the configuration file and in which file. Do we need to set this somewhere in sendmail.mc and if yes how to do that and do we need to restart sendmail after that?
Anything else which I am missing.

Thanks & Regards,
Sharad
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl Script to download file apt Programming 4 10-19-2005 08:33 AM
include a file in perl script Ateo Programming 1 04-22-2005 09:53 PM
executing perl script through .forward file skverma_in Linux - General 0 10-18-2004 05:06 AM
cant see .forward file in home directory >> mail forward/copy steve_babbage Linux - Newbie 0 03-02-2004 06:25 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM


All times are GMT -5. The time now is 09: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration