LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   executing perl script through .forward file (https://www.linuxquestions.org/questions/linux-newbie-8/executing-perl-script-through-forward-file-244951/)

skverma_in 10-20-2004 01:11 AM

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

fblucher 10-20-2004 01:16 AM

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.

skverma_in 10-20-2004 08:46 AM

----- 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,

skverma_in 10-21-2004 07:24 AM

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


All times are GMT -5. The time now is 12:28 PM.