Created
August 8, 2019 13:02
-
-
Save progress44/f37b0716a6676d5978001ac734bc3706 to your computer and use it in GitHub Desktop.
Clean docker logs if docker is misconfigured
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR=/var/lib/docker/containers | |
FILES=$(ls $DIR) | |
for f in $FILES | |
do | |
echo "Processing $f dir..." | |
# take action on each file. $f store current file name | |
ls -lash $DIR/$f | grep .log | |
LOGS=$(ls $DIR/$f/ | grep .log) | |
for l in $LOGS | |
do | |
echo "emptying $l logfille" | |
echo "" > $DIR/$f/$l | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment