Cyborg | 19 Jul 2012 11:36
Picon

run a command

Hi all,

there is this nice  "run{/enter/bin/here args}{1}{put fail string here}" 
construct. According to docs, it sets $value with the output of the cmd 
used.

how can i make that visible ?

this is not working, because it's an example :

drop  message    = you have been blacklisted.
         condition = ${run{/usr/bin/id >/tmp/id}{yes}{yes}}

(id will try to id the term ">/tmp/id" instead of reroute the output to it.)

How do i get the output of id ( not to find that userdata )  and log it  
to the mainlog ?

best regards,

Marius

--

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Jakob Hirsch | 19 Jul 2012 13:32
Picon
Gravatar

Re: run a command

Cyborg, 19.07.2012 11:36:

> how can i make that visible ?

As always, just use

> this is not working, because it's an example :
> 
> drop  message    = you have been blacklisted.
>         condition = ${run{/usr/bin/id >/tmp/id}{yes}{yes}}
>
> (id will try to id the term ">/tmp/id" instead of reroute the output to
> it.)

It's not working because the ">/tmp/id" is a shell idiom. You have to use
  ${run{/bin/bash -c "/usr/bin/id >/tmp/id"}{yes}{yes}}

But you don't need the redirection for what you want.

> How do i get the output of id ( not to find that userdata )  and log it 
> to the mainlog ?

This is not working?

drop
  condition   = ${run{/usr/bin/id}{yes}{no}}
  log_message = output of id: $value

--

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
(Continue reading)

Cyborg | 19 Jul 2012 15:40
Picon

Re: run a command


 <at> Phil:

Can you please add this as an example of how to use "$value" to the docs 
on page 106 of the 4.77 exim spec pdf .

>    condition   = ${run{/usr/bin/id}{yes}{no}}
>    log_message = output of id: $value
>

It is usefull, if the cmd execution failes and the admin wanne know why..

best regards,

  Marius Schwarz

--

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Todd Lyons | 19 Jul 2012 17:13
Gravatar

Re: run a command

On Thu, Jul 19, 2012 at 6:40 AM, Cyborg <cyborg2 <at> benderirc.de> wrote:
>
>  <at> Phil:
> Can you please add this as an example of how to use "$value" to the docs on
> page 106 of the 4.77 exim spec pdf .
>
>>    condition   = ${run{/usr/bin/id}{yes}{no}}
>>    log_message = output of id: $value

You're talking about the ${run definition in section 11.5 (Expansion
Items).  That seems reasonable.  I'll add a blurb.

...Todd
-- 
The total budget at all receivers for solving senders' problems is $0.
 If you want them to accept your mail and manage it the way you want,
send it the way the spec says to. --John Levine

--

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


Gmane