forked from evolix/evobackup
Parallelize bkctld <subcommand> all
This commit is contained in:
parent
16014f3c4f
commit
6caa9078e6
15
bkctld
15
bkctld
|
@ -35,20 +35,7 @@ case "${subcommand}" in
|
||||||
;;
|
;;
|
||||||
"start" | "stop" | "reload" | "restart" | "sync" | "update" | "remove")
|
"start" | "stop" | "reload" | "restart" | "sync" | "update" | "remove")
|
||||||
if [ "${jail}" = "all" ]; then
|
if [ "${jail}" = "all" ]; then
|
||||||
jails=$(ls "${JAILDIR}")
|
ls "${JAILDIR}"|xargs --no-run-if-empty --max-args=1 --max-procs=0 "${LIBDIR}/bkctld-${subcommand}"
|
||||||
for jail in ${jails}; do
|
|
||||||
case "${subcommand}" in
|
|
||||||
"start")
|
|
||||||
check_jail_on "${jail}" || "${LIBDIR}/bkctld-${subcommand}" "${jail}"
|
|
||||||
;;
|
|
||||||
"stop" | "reload" | "restart")
|
|
||||||
check_jail_on "${jail}" && "${LIBDIR}/bkctld-${subcommand}" "${jail}"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
"${LIBDIR}/bkctld-${subcommand}" "${jail}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
else
|
else
|
||||||
"${LIBDIR}/bkctld-${subcommand}" "${jail}"
|
"${LIBDIR}/bkctld-${subcommand}" "${jail}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -5,7 +5,7 @@ LIBDIR="$(dirname $0)" && . "${LIBDIR}/config"
|
||||||
jail="${1:-}"
|
jail="${1:-}"
|
||||||
[ -n "${jail}" ] || usage
|
[ -n "${jail}" ] || usage
|
||||||
check_jail "${jail}" || error "${jail} : trying to reload inexistant jail"
|
check_jail "${jail}" || error "${jail} : trying to reload inexistant jail"
|
||||||
check_jail_on "${jail}" || error "${jail} : trying to reload not running jail"
|
check_jail_on "${jail}" || exit 0
|
||||||
|
|
||||||
pid=$(cat "${JAILDIR}/${jail}/${SSHD_PID}")
|
pid=$(cat "${JAILDIR}/${jail}/${SSHD_PID}")
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ LIBDIR="$(dirname $0)" && . "${LIBDIR}/config"
|
||||||
jail="${1:-}"
|
jail="${1:-}"
|
||||||
[ -n "${jail}" ] || usage
|
[ -n "${jail}" ] || usage
|
||||||
check_jail "${jail}" || error "${jail} : trying to start inexistant jail"
|
check_jail "${jail}" || error "${jail} : trying to start inexistant jail"
|
||||||
check_jail_on "${jail}" && error "${jail} : trying to start already running jail"
|
check_jail_on "${jail}" && exit 0
|
||||||
|
|
||||||
cd "${JAILDIR}/${jail}"
|
cd "${JAILDIR}/${jail}"
|
||||||
grep -q "${JAILDIR}/${jail}/proc" /proc/mounts || mount -t proc "proc-${jail}" proc
|
grep -q "${JAILDIR}/${jail}/proc" /proc/mounts || mount -t proc "proc-${jail}" proc
|
||||||
|
|
|
@ -5,7 +5,7 @@ LIBDIR="$(dirname $0)" && . "${LIBDIR}/config"
|
||||||
jail="${1:-}"
|
jail="${1:-}"
|
||||||
[ -n "${jail}" ] || usage
|
[ -n "${jail}" ] || usage
|
||||||
check_jail "${jail}" || error "${jail} : trying to stop inexistant jail"
|
check_jail "${jail}" || error "${jail} : trying to stop inexistant jail"
|
||||||
check_jail_on "${jail}" || error "${jail} : trying to stop not running jail"
|
check_jail_on "${jail}" || exit 0
|
||||||
|
|
||||||
pid=$(cat "${JAILDIR}/${jail}/${SSHD_PID}")
|
pid=$(cat "${JAILDIR}/${jail}/${SSHD_PID}")
|
||||||
for conn in $(ps --ppid "${pid}" -o pid=); do
|
for conn in $(ps --ppid "${pid}" -o pid=); do
|
||||||
|
|
Loading…
Reference in a new issue