Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #11 from meltwater/loop
Browse files Browse the repository at this point in the history
Allow non-looped cleanups, fixes #10
  • Loading branch information
mikljohansson committed Feb 1, 2016
2 parents 80429e6 + 49b7130 commit a958443
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ ADD docker-cleanup-volumes.sh /docker-cleanup-volumes.sh
ENV CLEAN_PERIOD **None**
ENV DELAY_TIME **None**
ENV KEEP_IMAGES **None**
ENV LOOP true

ENTRYPOINT ["/run.sh"]
8 changes: 8 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ if [ "${KEEP_IMAGES}" == "**None**" ]; then
unset KEEP_IMAGES
fi

if [ "${LOOP}" != "false" ]; then
LOOP=true
fi

echo "=> Run the clean script every ${CLEAN_PERIOD} seconds and delay ${DELAY_TIME} seconds to clean."

trap '{ echo "User Interupt."; exit 1; }' SIGINT
Expand Down Expand Up @@ -123,6 +127,10 @@ do
fi

rm -f ToBeCleanedImageIdList ContainerImageIdList ToBeCleaned ImageIdList KeepImageIdList

# Run forever or exit after the first run depending on the value of $LOOP
[ "${LOOP}" == "true" ] || break

echo "=> Next clean will be started in ${CLEAN_PERIOD} seconds"
sleep ${CLEAN_PERIOD} & wait
done

0 comments on commit a958443

Please sign in to comment.