examples/init.sh: update to reduce upgrade raciness
[unicorn.git] / examples / unicorn@.service
blob56aaec82523d5900a219a43bcc0bb1d21b3e4ff6
1 # ==> /etc/systemd/system/unicorn@.service <==
2 # Since SIGUSR2 upgrades do not work under systemd, this service file
3 # allows starting two simultaneous services during upgrade time
4 # (e.g. unicorn@1 unicorn@2) with the intention that they take
5 # turns running in-between upgrades.  This should allow upgrading
6 # without downtime.
8 [Unit]
9 Description = unicorn Rack application server %i
10 Wants = unicorn.socket
11 After = unicorn.socket
13 [Service]
14 # bundler users must use the "--keep-file-descriptors" switch, here:
15 # ExecStart = bundle exec --keep-file-descriptors unicorn -c ...
16 ExecStart = /usr/bin/unicorn -c /path/to/unicorn.conf.rb /path/to/config.ru
17 Sockets = unicorn.socket
18 KillSignal = SIGQUIT
19 User = nobody
20 Group = nogroup
21 ExecReload = /bin/kill -HUP $MAINPID
23 # This is based on the Unicorn::Configurator#timeout directive,
24 # adding a few seconds for scheduling differences:
25 TimeoutStopSec = 62
27 [Install]
28 WantedBy = multi-user.target