When and how does digitalocean set a droplet's hostname?
One of the clever things that digitalocean does is to set the hostname of a new droplet to a sensible value. When, and how, does this happen?
I have a third-party daemon (newrelic-sysmond) that needs to know the hostname. When it starts, the hostname still is
packer-... and not the hostname set by the digitalocean droplet initiating process. In the
/etc/rc structure, the hostname is set in
rcS.d/S01hostname.sh, which should occur before
rc2.d/S01newrelic-sysmond. However, it seems the hostname still has the name at image-creation time by the time
rc2.d/S01newrelic-sysmond is run.