Fixes #208
If HOSTNAME is set (e.g. by Bash) then use it, otherwise fall back to hostname and then uname -n.
HOSTNAME
hostname
uname -n