hostname variable in attachment replacement

Glenn Steen glenn.steen at gmail.com
Thu Aug 6 16:28:03 IST 2009


2009/8/6 David Lee <t.d.lee at durham.ac.uk>:
> On Thu, 6 Aug 2009, Randal, Phil wrote:
>
>> Erik Bloodaxe wrote:
>> [...]
>>>>>
>>>>> Is there a way to have a variable in the attachements that replace
>>>>> unacceptable file types and content that expands to the host names.
>>>>>
>>>>> I.e. in stored.filename.message.txt in etc/reports/en
>>>>>
>>>>> I want a line saying
>>>>>
>>>>> File is in: $(HOSTNAME) in $quarantinedir/$datenumber/$id
>>>>>
>>>>> so that my sysadmins can see which of the many servers the file is
>>>>> on as the standard reports give them no indication of which server
>>>>> to get the file from.
>>>>>
>>>>> I have tried all the obvious
>>
>> [...]
>> I see that on CentOS 5.3 too, so it is no just your installation.
>
> Dare I say "me, too"?
>
> I seem to recall reporting this (empty 'HOSTNAME') a few years ago. We're
> now on CentOS 5.3 with MS 4.76.24, and a configuration that tries not to
> change things unnecessarily.  Still seeing it (although our MS configuration
> only rarely invokes pathways that need it.)
>
> I get the feeling that the _intended_ behaviour is for MS's "HOSTNAME"
> variable to try to inherit a default value from somewhere (i.e. to try to
> avoid being empty).
>
> This intention might be the result of "uname -n" or similar, and probably
> for a shell HOSTNAME variable, if any, to override it.  Fair enough. Indeed,
> when I ssh to a box, there is such a variable present on such a login.
>
> But I suspect that, on a reasonably "out of the box" Fedora/CentOS/Redhat
> installation, by the time "/etc/init.d" is starting MS, neither is HOSTNAME
> yet set, nor is MS getting it from executing "uname -n" (or similar).
>
> Shouldn't the startup algorithm be something like (pseudo-perl):
>
>   $HOSTNAME = if $ENV{'HOSTNAME'} was set
>               then $ENV{'HOSTNAME'}
>               else `uname -n`;
>               # i.e. inherit env.var. HOSTNAME
>               # else fall back to using system hostname
>
> Sorry that's so vague.  But I hope it helps.
>
>
> Jules: could you (a) confirm the intention (for HOSTNAME to be non-empty)
> (b) outline the intended algorithm to achieve that at "/etc/init.d"-driven
> startup?
>
Ok, so what do you have in your /etc/sysconfig/network file?
On my RH siblings (mandriva of diverse age:-), setting this cures any
name-related problems like these... So I would be very surprised if
this was a generic RH problem.

Cheers
-- 
-- Glenn
email: glenn < dot > steen < at > gmail < dot > com
work: glenn < dot > steen < at > ap1 < dot > se


More information about the MailScanner mailing list