System variables in MailScanner.conf

Julian Field MailScanner at
Wed Jul 13 16:17:50 IST 2005

Hash: SHA1

On 13 Jul 2005, at 16:03, Lars Kristiansen wrote:

>>>> Looks like it's a FreeBSD thing as my FreeBSD boxes (5.3 & 5.4) all
>>>> like
>>>> $HOST and 'Undefined Variable' $HOSTNAME
>> Actually, just took a look at 'man bash', it says "HOSTNAME"  
>> automatically
>> set to the name of the current host. :-)
>> Chen
> And something similar is mentioned for "HOST" in 'man tcsh'.
> csh (actually tcsh) is default root shell in freebsd if that was  
> not clear.
> And by the way, if HOSTNAME is set in /root/.cshrc,
>  "echo ${HOST}${HOSTNAME}" will return hostname twice, at least in  
> terminal.
> If not set it will only return this error message:
>  "HOSTNAME: Undefined variable." instead of any output at all.
> Not tested if output is different if not called from a terminal,  
> though.
> --
> Hilsen from Lars
>>> Maybe HOSTNAME is set by the shell, works in bash.
>>> A grep for HOSTNAME returns among others these:
>>> /etc/profile:
>>> HOSTNAME=`/bin/hostname`; export HOSTNAME
>>> So you I guess you would have to put in
>>> /etc/csh.login or in ~/.cshrc
>>> setenv HOSTNAME `/bin/hostname`

In MailScanner, it will be started from a /bin/sh at boot time, I  
believe. And since it looks them up in %ENV there isn't any scope for  
error messages, just empty values for keys that don't exist. So $ 
{HOSTNAME}${HOST} should be reasonably safe to use. Give it a try and  
see what happens on your systems.

- -- 
Julian Field
Buy the MailScanner book at
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654

Version: PGP Desktop 9.0.1 (Build 2185)


------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki ( and
the archives (

Support MailScanner development - buy the book off the website!

More information about the MailScanner mailing list