Get correct hostname for ejabberd and jwchat, when run inside a chroot.

Tested that this script works both within and outside of a chroot.