Skip to content

Instantly share code, notes, and snippets.

@Squab
Created March 1, 2015 00:45
Show Gist options
  • Save Squab/4cf8d8f14f510b9fd905 to your computer and use it in GitHub Desktop.
Save Squab/4cf8d8f14f510b9fd905 to your computer and use it in GitHub Desktop.
Get hostname in upstart script Ubuntu 14.04
description "example hostname script"
author "Tim Simmons"
setuid bob
start on runlevel [2345]
stop on runlevel [!2345]
# retry if ended unexpectedly
respawn
# limit the retries to max 15 times with timeouts of 5 seconds
respawn limit 15 5
# Time to wait between sending TERM and KILL signals
kill timeout 20
script
HOSTNAME=$(hostname -s)
exec /path/to/app -n $HOSTNAME
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment