hostname variable in attachment replacement

Glenn Steen glenn.steen at
Fri Aug 7 15:19:18 IST 2009

2009/8/7 Erik Bloodaxe <E.Bloodaxe at>:
> Glenn Steen wrote:
> 2009/8/6 Erik Bloodaxe <E.Bloodaxe at>:
> 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.
Weird. I just checked a CentOS 5 VM vs. my Mandriva setup, and the
hostname setup is exactly the same. I know for certain that the
Mandriva one works. But then, I do tend to make sure the
/etc/sysconfig/network file is correct, so that anything that would
source it get the HOSTNAME setting right, and make sure that I have
valid entries for the interfaces (loopback and real NICs) in
/etc/hosts (and have lookup order set to hosts first, then dns), to
make sure nothing like this can happen.

> 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 agree. Could you set it like I outline above, just to see if it
makes a difference?

> I suspect this is related to the various diffrent notions of domain and host
> name under Linux (solaris is simpler here)
... There can be only one!:-)

> on the box the dns domain name is set but the domiain name not!
Sounds like it is jumbled then. Try setting it as suggested and do a
reboot (perhaps make sure your "login script hack" is disabled).

> Erik

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

More information about the MailScanner mailing list