@@ -30,5 +30,6 @@ fn-help-content() {
|
||||
run [-e|--env KEY=VALUE] [--no-tty] <app> <cmd>, Run a command in a new container using the current app image
|
||||
run:detached [-e|-env KEY=VALUE] [--no-tty] <app> <cmd>, Run a command in a new detached container using the current app image
|
||||
run:list [--format json|stdout] <app>, List all run containers for an app
|
||||
run:stop <app|--container CONTAINER>, Stops all run containers for an app or a specified run container
|
||||
help_content
|
||||
}
|
||||
|
||||
@@ -109,3 +109,35 @@ cmd-run-list() {
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-run-list "$DOKKU_SCHEDULER" "$APP" "$FORMAT"
|
||||
}
|
||||
|
||||
cmd-run-stop() {
|
||||
declare desc="Stops all run containers for an app or a specified run container"
|
||||
declare cmd="run:stop"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP CONTAINER_NAME
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--container=*)
|
||||
local arg=$(printf "%s" "$1" | sed -E 's/(^--container=)//g')
|
||||
CONTAINER_NAME="$arg"
|
||||
shift
|
||||
;;
|
||||
--container)
|
||||
if [[ ! $2 ]]; then
|
||||
dokku_log_warn "expected $1 to have an argument"
|
||||
break
|
||||
fi
|
||||
CONTAINER_NAME="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
APP="$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-run-stop "$DOKKU_SCHEDULER" "$APP" "$CONTAINER_NAME"
|
||||
}
|
||||
|
||||
6
plugins/run/subcommands/stop
Executable file
6
plugins/run/subcommands/stop
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
source "$PLUGIN_AVAILABLE_PATH/run/internal-functions"
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-run-stop "$@"
|
||||
Reference in New Issue
Block a user