summaryrefslogtreecommitdiff
path: root/tcwg-cleanup-stale-containers.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2016-11-08 12:23:41 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2016-11-08 12:23:41 +0000
commit2acff61e04382bf8c8cc2a06bafd48ed5577a72a (patch)
treedb3812c7b5019854cfde87f639a2c3ce9322f4ff /tcwg-cleanup-stale-containers.sh
parentcc4b338b71c3b081f1528a6b01f86cffcfb9c5d7 (diff)
tcwg-cleanup-stale-containers: Handle verbose
Change-Id: If3898928a9231b90e115e60fd400cbb29ff4b553
Diffstat (limited to 'tcwg-cleanup-stale-containers.sh')
-rwxr-xr-xtcwg-cleanup-stale-containers.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/tcwg-cleanup-stale-containers.sh b/tcwg-cleanup-stale-containers.sh
index 97406a7d..5b3b36ca 100755
--- a/tcwg-cleanup-stale-containers.sh
+++ b/tcwg-cleanup-stale-containers.sh
@@ -5,18 +5,23 @@ set -e
docker_ps_opts=""
dry_run=false
hours="10"
+verbose=false
-OPTS="`getopt -o v -l docker_ps_opts:,dry_run,hours: -- "$@"`"
+OPTS="`getopt -l docker_ps_opts:,dry_run:,hours:,verbose: -- "$@"`"
while test $# -gt 1; do
case $1 in
--docker_ps_opts) docker_ps_opts="$2"; shift ;;
--dry_run) dry_run="$2"; shift ;;
--hours) hours="$2"; shift ;;
- -v) set -x ;;
+ --verbose) verbose="$2"; shift ;;
esac
shift
done
+if $verbose; then
+ set -x
+fi
+
if [ "$hours" -lt "1" ]; then
echo "ERROR: Refusing to delete containers that are $hours days old"
exit 1