summaryrefslogtreecommitdiff
path: root/tcwg-cleanup-stale-containers.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-04-26 07:08:53 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-04-28 07:49:20 +0000
commitaa6ef0d5b6d95e7730257ba9efcb0ed760ab7eae (patch)
tree75a1b4f5217f9967251df6820e5cffcdf1a85671 /tcwg-cleanup-stale-containers.sh
parent489d4a5c4ea507705cf876c381dc2186f4b992aa (diff)
tcwg-cleanup-stale-containers: Add usage
Change-Id: Ie12e9a64a4ed1d21ab9c155c3f263467c950176d
Diffstat (limited to 'tcwg-cleanup-stale-containers.sh')
-rwxr-xr-xtcwg-cleanup-stale-containers.sh24
1 files changed, 23 insertions, 1 deletions
diff --git a/tcwg-cleanup-stale-containers.sh b/tcwg-cleanup-stale-containers.sh
index 2ad7c2a0..b605d13d 100755
--- a/tcwg-cleanup-stale-containers.sh
+++ b/tcwg-cleanup-stale-containers.sh
@@ -2,6 +2,28 @@
set -e
+usage ()
+{
+ cat <<EOF
+Options:
+ --cleanup-running-hours HOURS
+ --cleanup-stopped-hours HOURS
+ Cleanup running/stopped containers that have been created more
+ than HOURS ago. Setting HOURS to negative values will
+ run the cleanup in dry-run mode.
+
+ --cleanup-images true/false
+ Whether to cleanup untagged images
+
+ --cleanup-volumes true/false
+ Whether to cleanup dangling volumes
+
+ --verbose true/false
+ Whether to run in verbose mode
+EOF
+ exit 1
+}
+
cleanup_running_hours="-10"
cleanup_stopped_hours="-240"
cleanup_images=false
@@ -15,7 +37,7 @@ while [ $# -gt 0 ]; do
--cleanup-images) cleanup_images="$2"; shift ;;
--cleanup-volumes) cleanup_volumes="$2"; shift ;;
--verbose) verbose="$2"; shift ;;
- *) echo "ERROR: Wrong option: $1"; exit 1 ;;
+ *) echo "ERROR: Wrong option: $1"; usage ;;
esac
shift
done