diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 7b695f175..d3d0aa019 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -437,6 +437,24 @@ APP="$1"; dokku postgres:destroy $APP ``` +### `post-stop` + +- Description: Can be used to run commands after an application is manually stopped +- Invoked by: `dokku ps:stop` +- Arguments: `$APP` +- Example: + +```shell +#!/usr/bin/env bash +# Marks an application as manually stopped + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +APP="$1"; + +dokku config:set --no-restart $APP MANUALLY_STOPPED=1 +``` + ### `docker-args-build` - Description: diff --git a/plugins/ps/commands b/plugins/ps/commands index 3e0a7357a..d7618d4cc 100755 --- a/plugins/ps/commands +++ b/plugins/ps/commands @@ -41,6 +41,7 @@ case "$1" in if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then echo "Stopping $APP ..." docker stop $DOKKU_APP_RUNNING_CONTAINER_IDS > /dev/null || true + plugn trigger post-stop $APP else echo "App $APP already stopped" fi