#!/bin/sh
#
# Debian's ssh.service reloads in two steps:
#   ExecReload=/usr/sbin/sshd -t
#   ExecReload=/bin/kill -HUP $MAINPID
# The order matters. sshd re-execs itself on SIGHUP and exits if the
# configuration does not parse -- HUPing a broken sshd_config takes away the
# rescue anchor of the machine. So: test first, signal only on success.
#
# Replaces the former actions.d/reload (plain "SIGHUP"); svctl-reload prefers
# actions.d/reload over actions.d/reloadcmd, so the two must not coexist.

set -e

/usr/sbin/sshd -t

exec s6-svc -h /run/s6-rc/scandir/ssh
