evobackup/lib/bkctld-sync
Victor LABORIE 842e57ba53 Big refactoring
* Jails are created on start and run in tmpfs
* All config files are on /etc/bkctld
* Cleaning of sshd_config and /etc/group
2020-01-08 14:46:18 +01:00

24 lines
718 B
Bash
Executable file

#!/bin/sh
#
# Sync jail <jailname> or all to another node
# Usage: sync <jailname>|all
#
LIBDIR="$(dirname $0)" && . "${LIBDIR}/config"
jail="${1:-}"
if [ ! -n "${jail}" ]; then
"${LIBDIR}/bkctld-help" && exit 1
fi
[ -d "${CONFDIR}/${jail}" ] || error "${jail} : trying to sync inexistant jail"
[ -n "${NODE}" ] || error "Sync need config of \$NODE in /etc/default/bkctld !"
jail="${1}"
rsync -a "${CONFDIR}/${jail}/" "${NODE}:${CONFDIR}/${jail}/" | debug
"${LIBDIR}/bkctld-is-on" "${jail}" && ssh "${NODE}" "${LIBDIR}/bkctld-start" "${jail}" | debug
if [ -n "${FIREWALL_RULES}" ]; then
rsync -a "${FIREWALL_RULES}" "${NODE}:${FIREWALL_RULES}"
ssh "${NODE}" /etc/init.d/minifirewall restart | debug
fi