Files
dokku/plugins/ps/commands
Jose Diaz-Gonzalez 59c9207797 Implement restart-policy handling. Closes #1734
Applications without a restart-policy will have their policies set to `on-failure:10`. Users can completely unset the restart-policy using the `docker-options` plugin, though this will be equivalent to setting it explicitly to `no`.

Restart policies must be explicitly set, and the following are all valid:

- no
- unless-stopped
- always
- on-failure
- on-failure:NUMBER
2016-07-02 17:22:54 -04:00

41 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
[[ " help ps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | ps:help)
help_content_func () {
declare desc="return ps plugin help content"
cat<<help_content
ps <app>, List processes running in app container(s)
ps:scale [<app> <proc>=<count> [<proc>=<count>]], Get/Set how many instances of a given process to run
ps:start <app>, Start app container(s)
ps:stop <app>, Stop app container(s)
ps:rebuild <app>, Rebuild an app
ps:rebuildall, Rebuild all apps
ps:restart <app>, Restart app container(s)
ps:restartall, Restart all deployed app containers
ps:restore, Start previously running apps e.g. after reboot
ps:restart-policy <app>, Shows the restart-policy for an app
ps:set-restart-policy <app> <policy>, Sets app restart-policy
help_content
}
if [[ $1 = "ps:help" ]] ; then
echo -e 'Usage: dokku ps[:COMMAND]'
echo ''
echo 'List running processes in container, and restart app.'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
;;
*)
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac