Skip to content

Commit

Permalink
send SIGHUP to remaining processes
Browse files Browse the repository at this point in the history
change-type: patch
  • Loading branch information
ab77 committed Aug 14, 2023
1 parent c6c2bdb commit e9809fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
5 changes: 5 additions & 0 deletions config/confd/templates/open-balena-vpn.service.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ KillMode=mixed
# https://www.freedesktop.org/software/systemd/man/systemd.service.html#TimeoutStopSec=
# ensure k8s/terminationGracePeriodSeconds matches
TimeoutStopSec={{ if getenv "DEFAULT_SIGTERM_TIMEOUT" }}{{ getenv "DEFAULT_SIGTERM_TIMEOUT" }}{{ else }}120{{ end }}
# https://www.freedesktop.org/software/systemd/man/systemd.kill.html#SendSIGHUP=
# Specifies whether to send SIGHUP to remaining processes immediately after sending the
# signal configured with KillSignal=. This is useful to indicate to shells and shell-like
# programs that their connection has been severed.
SendSIGHUP=yes

Restart=always
SyslogIdentifier=vpn
Expand Down
39 changes: 3 additions & 36 deletions config/services/open-balena-vpn.service
Original file line number Diff line number Diff line change
@@ -1,42 +1,9 @@
# Copyright (C) 2015 Balena Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

[Unit]
Description=open-balena-vpn
Requires=confd.service haproxy.service
After=confd.service
StartLimitIntervalSec=0
Description=open-balena-vpn service stub

[Service]
StandardOutput=journal+console
StandardError=journal+console
WorkingDirectory=/usr/src/app
EnvironmentFile=/usr/src/app/config/env
ExecStart=/usr/src/app/bin/start.sh
ExecStop=-/usr/src/app/bin/stop.sh
# https://www.freedesktop.org/software/systemd/man/systemd.kill.html#KillMode=
# only send SIGTERM to master process, send SIGKILL to all remaining processes in the
# group after TimeoutStopSec has elapsed; this setting prevents VPN worker(s) from
# restarting after SIGTERM is received and before SIGKILL
KillMode=mixed
# https://www.freedesktop.org/software/systemd/man/systemd.service.html#TimeoutStopSec=
# ensure k8s/terminationGracePeriodSeconds matches
TimeoutStopSec=${DEFAULT_SIGTERM_TIMEOUT}

Restart=always
SyslogIdentifier=vpn
Type=simple
ExecStart=true

[Install]
WantedBy=basic.target

0 comments on commit e9809fd

Please sign in to comment.