hostname variable in attachment replacement

Erik Bloodaxe E.Bloodaxe at gold.ac.uk
Fri Aug 7 14:46:39 IST 2009


Glenn Steen wrote:
> 2009/8/6 Erik Bloodaxe <E.Bloodaxe at gold.ac.uk>:
>   
>> Julian Field wrote:
>>     
>>>> # grep Hostname /opt/MailScanner/etc/MailScanner.conf
>>>> # definition of "Hostname" for an example.
>>>> # Hostname = the %org-name% ($HOSTNAME) MailScanner
>>>> #Hostname = the %org-name% ($HOSTNAME) MailScanner
>>>> Hostname = the %org-name% MailScanner (on $HOSTNAME)
>>>>
>>>> And HOSTNAME cones out as blank.
>>>>         
>>> Unfortunate.
>>>       
>> Am I to conclude that there is no solution then?
>>
>> Erik
>>     
>
> Erik,
> I suspect you may not have set your host(s) name(s) correctly
> (inferred from your first comment). Setting it can differ a bit
> depending on the rc-scripts involved, but on most RH-type installs you
> either have to correctly set up nsswitch.cnf (and friends, for yp/NIS
> "disabed" systems:-) or the /etc/sysconfig/network file (simply put a
> line with HOSTNAME=<your hosts FQDN> in there). If you haven't done
> that, gethostbyname or gethostname will  fail to return the name and
> thus give the result you see.
> An alternative (if CentOS 5.3 has changed things in a drastic way:-)
> would be to call hostname (see the manpage) in /etc/rc.local, but...
> This has been like this for ages, so I suspect you wouldn't need to.
>
> Having either the NIS stuff correct, or the file (if you don't use NIS
> for this), will make some appropriate rc-script run the hostname
> command for you upon reboot... So, as usual, you don't really need
> reboot, just fix the config and run the command by hand.
>
> As usual, especially when I'm fresh back from vacation, I might be
> totally wrong;-).
> Cheers
>   
the hostname command produces the right output so the hostname was set 
up correctly during install.
Curiously uname -a and hostname work despite 
HOSTNAME=localdomain.localhost in /etc/sysconfig/network.

This is a realy simple standard out of the box RH install.

I solved it as suggested by adding a
HOSTNAME=`/bin/hostname`
export HOSTNAME

to the start up script, but this should work out of the box.

I suspect this is related to the various diffrent notions of domain and 
host name under Linux (solaris is simpler here)
on the box the dns domain name is set but the domiain name not!

Erik

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20090807/24c12f68/attachment.html


More information about the MailScanner mailing list