Re: [exim] Reading the value of a macro from a shell script

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Terry Burton
Date:  
À: exim-users
CC: exim-users
Sujet: Re: [exim] Reading the value of a macro from a shell script
On Dec 20, 2007 10:42 PM, Phil Pennock <exim-users@???> wrote:
> On 2007-12-20 at 17:37 +0000, Terry Burton wrote:
> > Otherwise, is there a recommended way to obtain such values from a
> > shell script without having to hardcode the value or grep the Exim
> > config?
>
> With well-defined data syntaxes and exiting after first match (anchored
> to the start of the line) grep is good. It's certainly going to be
> faster than launching the full MTA; further, a broken config file may
> cause the MTA to complain, so your error handling logic just got a lot
> harder.
>
> % grep -m1 '^TLSCERTIFICATESDIR\b' /etc/exim/exim.conf
> TLSCERTIFICATESDIR=/etc/ssl/services/exim
>
> That does fall down if you pull in extra config files or use
> redefinitions; presumably if you are then you can adjust your scripts
> accordingly.


Hi Phil,

True, but this hurts a little if instead the exim parser can be easily
utilised for this. :-)

My inspiration comes from the amgetconf(8) utility from the Amanda
backup software which usually requires a number of custom helper
scripts to integrate it into any reasonably complex environment. From
experience I have found that extracting the settings at the top of a
script using this approach makes maintaining these helpers much easier
and results in fewer nasty surprises when somebody updates the core
configuration.

<...snip...>
> For anything except macros, Exim can use the arguments to -bP to output
> it. If you think macros would be useful, file a feature request bug.


Feature request filed: http://bugs.exim.org/show_bug.cgi?id=643

Many thanks for your ideas and help with this.


Thanks again,

Tez