init: Fix upstart script for Centos6 (and Amazon Linux) (#1914)

This commit is contained in:
Eugene Dementiev 2017-10-13 12:02:46 +13:00 committed by Matt Holt
parent 99625ae3f6
commit 0548b97701

View file

@ -3,19 +3,11 @@ description "Caddy HTTP/2 web server"
start on runlevel [2345]
stop on runlevel [016]
# centos 6 upstart version does not support console
console log
# centos 6 upstart version does not support setuid/setgid
setuid www-data
setgid www-data
console output
respawn
respawn limit 10 5
# centos 6 upstart version does not support reload
reload signal SIGUSR1
# Let's Encrypt certificates will be written to this directory.
env CADDYPATH=/etc/ssl/caddy
@ -24,5 +16,6 @@ limit nofile 1048576 1048576
script
cd /etc/ssl/caddy
rootdir="$(mktemp -d -t "caddy-run.XXXXXX")"
exec /usr/local/bin/caddy -agree -log=stdout -conf=/etc/caddy/Caddyfile -root=$rootdir
chown www-data:www-data $rootdir
exec sudo -u www-data /usr/local/bin/caddy -agree -log=/var/log/caddy.log -conf=/etc/caddy/Caddyfile -root=$rootdir
end script