diff --git a/bkctld b/bkctld index 4032bf9..67e74b1 100755 --- a/bkctld +++ b/bkctld @@ -35,24 +35,21 @@ fi . "${LIBDIR}/includes" subcommand="${1:-}" -jail_name="${2:-}" -option="${3:-}" - -if [ ! -x "${LIBDIR}/bkctld-${subcommand}" ]; then - "${LIBDIR}/bkctld-help" && exit 1 -fi - case "${subcommand}" in "inc" | "rm" | "check" | "stats" | "help" | "list") "${LIBDIR}/bkctld-${subcommand}" ;; "init" | "is-on") + jail_name="${2:-}" "${LIBDIR}/bkctld-${subcommand}" "${jail_name}" ;; "key" | "port" | "ip") + jail_name="${2:-}" + option="${3:-}" "${LIBDIR}/bkctld-${subcommand}" "${jail_name}" "${option}" ;; "start" | "stop" | "reload" | "restart" | "sync" | "update" | "remove" | "firewall") + jail_name="${2:-}" if [ "${jail_name}" = "all" ]; then "${LIBDIR}/bkctld-list" | xargs --no-run-if-empty --max-args=1 --max-procs=0 "${LIBDIR}/bkctld-${subcommand}" else @@ -60,10 +57,15 @@ case "${subcommand}" in fi ;; "status") + jail_name="${2:-}" if [ "${jail_name}" = "all" ] || [ -z "${jail_name}" ]; then "${LIBDIR}/bkctld-list" | xargs --no-run-if-empty --max-args=1 "${LIBDIR}/bkctld-${subcommand}" else "${LIBDIR}/bkctld-${subcommand}" "${jail_name}" fi ;; + *) + "${LIBDIR}/bkctld-help" + exit 1 + ;; esac