Skip to content

Instantly share code, notes, and snippets.

@homburg
Last active January 4, 2019 21:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save homburg/c13b7a75b08955f6902c to your computer and use it in GitHub Desktop.
Save homburg/c13b7a75b08955f6902c to your computer and use it in GitHub Desktop.
Golang upstart init script (from githbucket.org/kardianos/service)
# /etc/init/my-go-service.conf
# My go service
description "My go service"
env DAEMON=/usr/local/bin/my-go-service
env NAME=my-go-service
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
#setuid username
kill signal INT
respawn
respawn limit 10 5
umask 022
#console none
pre-start script
test -x $DAEMON || { stop; exit 0; }
end script
# Start
script
test -f /etc/default/$NAME && . /etc/default/$NAME
exec $DAEMON
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment