comparison docker/libervia_cont.sh @ 104:b59491821a8a

docker (libervia_cont): added a "stats" command for containers resources usage statistics
author Goffi <goffi@goffi.org>
date Sat, 27 Feb 2016 00:45:58 +0100
parents e69883c1ec30
children a7b8bb39736b
comparison
equal deleted inserted replaced
103:e69883c1ec30 104:b59491821a8a
54 PORT_8443_NAME="HTTPS" 54 PORT_8443_NAME="HTTPS"
55 NO_PORT="No public port" 55 NO_PORT="No public port"
56 56
57 DOCKER_EXE="docker" 57 DOCKER_EXE="docker"
58 58
59 USAGE="Usage: $0 [start|stop|restart|status|update|backup|restore|ports|config] [ARGS...]" 59 USAGE="Usage: $0 [start|stop|restart|status|update|backup|restore|ports|config|stats] [ARGS...]"
60 60
61 HELP_SITE="https://wiki.goffi.org/wiki/Docker/en" 61 HELP_SITE="https://wiki.goffi.org/wiki/Docker/en"
62 HELP_MUC="sat@chat.jabberfr.org" 62 HELP_MUC="sat@chat.jabberfr.org"
63 63
64 CONT_CERT_DIR="/usr/share/sat/certificates" 64 CONT_CERT_DIR="/usr/share/sat/certificates"
204 update) CMD=UPDATE;; 204 update) CMD=UPDATE;;
205 backup) CMD=BACKUP;; 205 backup) CMD=BACKUP;;
206 restore) CMD=RESTORE;; 206 restore) CMD=RESTORE;;
207 ports) CMD=PORTS;; 207 ports) CMD=PORTS;;
208 config) CMD=CONFIG;; 208 config) CMD=CONFIG;;
209 stats) CMD=STATS;;
209 -v|--version) printf "$VERSION\n"; exit 0;; 210 -v|--version) printf "$VERSION\n"; exit 0;;
210 -h|--help) printf "$USAGE\n\nYou can check $HELP_SITE for instructions, or go to $HELP_MUC XMPP MUC room for help\n"; exit 0;; 211 -h|--help) printf "$USAGE\n\nYou can check $HELP_SITE for instructions, or go to $HELP_MUC XMPP MUC room for help\n"; exit 0;;
211 *) echo $USAGE 212 *) echo $USAGE
212 exit 1 213 exit 1
213 esac 214 esac
411 printf "updating configuration\n" 412 printf "updating configuration\n"
412 docker cp "$TMP_DIR/$HOST_CONF_FILE" "$VOLUME_ALIAS:$CONT_CONF_FILE" 413 docker cp "$TMP_DIR/$HOST_CONF_FILE" "$VOLUME_ALIAS:$CONT_CONF_FILE"
413 fi 414 fi
414 rm -rf "$TMP_DIR" 415 rm -rf "$TMP_DIR"
415 ;; 416 ;;
416 417 STATS)
418 if [ -n "$1" -a "$1" != "--no-stream" ]; then
419 printf "usage: $0 stats [--no-stream]\n"
420 exit 1
421 fi
422 docker stats $1 $CONTAINERS
423 ;;
417 *) printf "Error: unknown command !" 424 *) printf "Error: unknown command !"
418 exit 2 425 exit 2
419 esac 426 esac