hostname variable in attachment replacement

Glenn Steen glenn.steen at
Thu Aug 6 16:23:49 IST 2009

2009/8/6 Glenn Steen <glenn.steen at>:
> 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

Another thing that might be happening could be the order of the init
scripts being a bit ... unfortunate. See that hostname isn't set after
MailScanner starts:)

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

More information about the MailScanner mailing list