subcommand restructure and bashstyle refactor. closes #1579
This commit is contained in:
committed by
Michael Hobbs
parent
76e27f0333
commit
89f289b433
23
plugins/ps/subcommands/default
Executable file
23
plugins/ps/subcommands/default
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
ps_main_cmd() {
|
||||
local desc="shows running processes in all running app containers"
|
||||
local cmd="ps"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
|
||||
local APP="$2"; verify_app_name "$APP"
|
||||
local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP")
|
||||
|
||||
! (is_deployed "$APP") && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
for CID in $DOKKU_APP_RUNNING_CONTAINER_IDS; do
|
||||
has_tty && DOKKU_RUN_OPTS="-i -t"
|
||||
dokku_log_info1_quiet "running processes in container: $CID"
|
||||
# shellcheck disable=SC2086
|
||||
docker exec $DOKKU_RUN_OPTS $CID /bin/sh -c "ps auxwww"
|
||||
done
|
||||
}
|
||||
|
||||
ps_main_cmd "$@"
|
||||
13
plugins/ps/subcommands/rebuild
Executable file
13
plugins/ps/subcommands/rebuild
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
ps_rebuild_cmd() {
|
||||
local desc="rebuilds app via command line"
|
||||
local cmd="ps:rebuild"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
ps_rebuild "$2"
|
||||
}
|
||||
|
||||
ps_rebuild_cmd "$@"
|
||||
14
plugins/ps/subcommands/rebuildall
Executable file
14
plugins/ps/subcommands/rebuildall
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
ps_rebuildall_cmd() {
|
||||
local desc="rebuilds all deployed apps via command line"
|
||||
local cmd="ps:rebuildall"
|
||||
for app in $(dokku_apps); do
|
||||
is_deployed "$app" && ps_rebuild "$app"
|
||||
done
|
||||
}
|
||||
|
||||
ps_rebuildall_cmd "$@"
|
||||
13
plugins/ps/subcommands/restart
Executable file
13
plugins/ps/subcommands/restart
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
ps_restart_cmd() {
|
||||
local desc="restarts app via command line"
|
||||
local cmd="ps:restart"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
ps_restart "$2"
|
||||
}
|
||||
|
||||
ps_restart_cmd "$@"
|
||||
14
plugins/ps/subcommands/restartall
Executable file
14
plugins/ps/subcommands/restartall
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
ps_restartall_cmd() {
|
||||
local desc="restarts all apps via command line"
|
||||
local cmd="ps:restartall"
|
||||
for app in $(dokku_apps); do
|
||||
ps_restart "$app"
|
||||
done
|
||||
}
|
||||
|
||||
ps_restartall_cmd "$@"
|
||||
18
plugins/ps/subcommands/restore
Executable file
18
plugins/ps/subcommands/restore
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
ps_restore_cmd() {
|
||||
local desc="starts all apps with DOKKU_APP_RESTORE not set to 0 via command line"
|
||||
local cmd="ps:restore"
|
||||
for app in $(dokku_apps); do
|
||||
local DOKKU_APP_RESTORE=$(dokku config:get "$app" DOKKU_APP_RESTORE || true)
|
||||
if [[ $DOKKU_APP_RESTORE != 0 ]]; then
|
||||
echo "Restoring app $app ..."
|
||||
ps_start "$app"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
ps_restore_cmd "$@"
|
||||
14
plugins/ps/subcommands/scale
Executable file
14
plugins/ps/subcommands/scale
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
ps_scale_cmd() {
|
||||
local desc="sets app scaling config via command line"
|
||||
local cmd="ps:scale"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
shift 1
|
||||
ps_scale "$@"
|
||||
}
|
||||
|
||||
ps_scale_cmd "$@"
|
||||
13
plugins/ps/subcommands/start
Executable file
13
plugins/ps/subcommands/start
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
ps_start_cmd() {
|
||||
local desc="starts app via command line"
|
||||
local cmd="ps:start"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
ps_start "$2"
|
||||
}
|
||||
|
||||
ps_start_cmd "$@"
|
||||
13
plugins/ps/subcommands/stop
Executable file
13
plugins/ps/subcommands/stop
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
ps_stop_cmd() {
|
||||
local desc="stops app via command line"
|
||||
local cmd="ps:stop"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
ps_stop "$2"
|
||||
}
|
||||
|
||||
ps_stop_cmd "$@"
|
||||
Reference in New Issue
Block a user