Skip to content

Commit

Permalink
Merge pull request #33 from appcelerator/monitor
Browse files Browse the repository at this point in the history
Add a monitor command to the swarm script
  • Loading branch information
generalhenry authored and chrisccoy committed Aug 15, 2016
2 parents c523670 + 496f4b3 commit 6d25e9e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion swarm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ROLE=infrastructure
usage() {
cat << USAGE >&2
Usage:
$(basename $0) [pull|start|stop|restart|ls]
$(basename $0) [pull|start|stop|restart|ls|monitor]
$(basename $0) [ -h | --help ]
Basic AMP swarm operations.
Expand All @@ -98,6 +98,7 @@ Commands:
restart Restart services (options: --min); same as stop, pull, start
stop Remove services
ls List running services
monitor Continually update running services list with current status
USAGE
exit 1
Expand Down Expand Up @@ -135,6 +136,9 @@ main() {
ls)
ls
;;
monitor)
monitor "${@:2}"
;;
-h)
usage
;;
Expand Down Expand Up @@ -197,6 +201,11 @@ ls() {
docker service ls --filter "label=amp.swarm=$ROLE"
}

monitor() {
interval=${1:-5}
clear; while true; do tput cup 0 0; docker service ls; sleep $interval; done
}

ampagent() {
docker service create --network amp-swarm --name amp-agent \
--mode global \
Expand Down

0 comments on commit 6d25e9e

Please sign in to comment.