evobackup/server/lib/bkctld-reload

27 lines
583 B
Plaintext
Raw Normal View History

2019-01-04 13:51:05 +01:00
#!/bin/sh
#
# Description: Reload SSH server
# Usage: reload [<jailname>|all]
#
2019-01-04 13:51:05 +01:00
2020-04-02 13:44:13 +02:00
# shellcheck source=./includes
2020-04-02 00:31:57 +02:00
LIBDIR="$(dirname $0)" && . "${LIBDIR}/includes"
2019-01-04 13:51:05 +01:00
2020-04-02 13:44:13 +02:00
jail_name="${1:?}"
2020-04-02 01:07:12 +02:00
if [ -z "${jail_name}" ]; then
show_help && exit 1
fi
2020-04-02 01:07:12 +02:00
jail_path=$(jail_path "${jail_name}")
2019-01-04 13:51:05 +01:00
test -d "${jail_path}" || error "${jail_name}: jail not found" 2
2019-01-04 13:51:05 +01:00
2020-04-02 01:07:12 +02:00
"${LIBDIR}/bkctld-is-on" "${jail_name}" || exit 0
pid=$(cat "${jail_path}/${SSHD_PID}")
2020-04-20 08:29:21 +02:00
if kill -HUP "${pid}"; then
notice "Reload jail \`${jail_name}' : OK [${pid}]"
else
error "Reload jail \`${jail_name}' : failed [${pid}]"
fi