[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shell script reading stdin?



Mike Werner <reznaeous@earthlink.net> wrote:
>It appears I was too optomistic.  It's not working.  Here's the error from
>the exim log (originally all one line - wrapped here for clarity):
>
>2000-06-11 14:13:02 131CEI-0002xP-00 **
>|/home/picuser/picadmin/message_handle.sh
><picuser@localhost> D=userforward T=address_pipe: Child process of 
>address_pipe transport returned 1 from command:
> /home/picuser/picadmin/message_handle.sh
>
>The local username on my box is picuser, and the shell script I'm trying to
>write is message_handle.sh

[snip]

>Here's the shell script as it currently stands:
>
>----- start message_handle.sh -----
>#!/bin/sh
>
>WD = /home/picuser/picadmin
>
>exec cat > $WD/message.txt
>return 0
>----- end message_handle.sh -----
>
>As you can see, it is a *very* simple script.

This has bitten me before. cat is an external command, living in
/bin/cat, and so /bin needs to be on your $PATH in order for this to
work. Normally it is, but by default exim filters are run with only
/usr/bin on their $PATH.

Either edit /etc/exim.conf and add a line reading 'path = /usr/bin:/bin'
to the address_pipe transport (just below 'driver = pipe') [1], or else
put 'export PATH=/usr/bin:/bin' at the top of any shell scripts you call
from your .forward file. I've tested the second of these, but not the
first. :) You could also just use '/bin/cat' instead of 'cat'.

[1] I'm assuming you're using something close to the default exim.conf
    here.

-- 
Colin Watson                                     [cjw44@flatline.org.uk]



Reply to: