cleanup tmpdir in janitor

This commit is contained in:
Girish Ramakrishnan
2015-10-14 23:08:36 -07:00
parent b3b4106b99
commit a977597217
3 changed files with 61 additions and 12 deletions

View File

@@ -24,16 +24,6 @@ readonly containers=$(docker ps -qa)
for container in $containers; do
echo "Cleaning up $container"
if tmpdir=$(docker inspect --format='{{index .Volumes "/tmp"}}' $container); then
echo -e "\tRemoving old files from $tmpdir"
if [[ $tmpdir == /home/yellowtent/data/docker/volumes/* ]]; then
find $tmpdir -mtime +10 -exec rm -rf {} + # 10 days max. note we cannot use atime because this is not a tmpfs
else
echo -e "\tInternal error in script. /tmp is mounted at unexpected location $tmpdir"
fi
fi
if logdir=$(docker inspect --format='{{index .Volumes "/var/log"}}' $container); then
echo -e "\tLogrotate files under $logdir"