#!/bin/sh
function doDockerLog(){
for element in `ls $1`
do
dir_or_file=$1"/"$element
if [ -d $dir_or_file ]
then
doDockerLog $dir_or_file
else
if [ ${dir_or_file:0-8:8} == 'json.log' ] || [ ${dir_or_file:0-10:10} == 'json.log.1' ]
then
echo $dir_or_file
#日志操作
cat /dev/null > $dir_or_file
fi
fi
done
}
dc="/var/lib/docker/containers"
doDockerLog $dc
清空docker日志
最新推荐文章于 2024-06-19 10:45:36 发布