2022-05-20 22:53:59 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Exit immediately for non zero status
|
|
|
|
set -e
|
|
|
|
|
|
|
|
log_dir=${1:-"logs"}
|
|
|
|
array=($(docker-compose ps -a|awk 'NR == 1 {next} {print $1}'))
|
|
|
|
echo ${array[@]}
|
|
|
|
if [ ! -d $log_dir ];
|
|
|
|
then
|
|
|
|
mkdir -p $log_dir
|
|
|
|
fi
|
|
|
|
echo "export logs start"
|
|
|
|
for container in ${array[*]}
|
|
|
|
do
|
2022-05-25 18:41:59 +08:00
|
|
|
if [[ $container == milvus-* ]];
|
|
|
|
then
|
|
|
|
echo "export logs for container $container "
|
|
|
|
docker logs $container > ./$log_dir/$container.log 2>&1 || echo "export logs for container $container failed"
|
|
|
|
fi
|
2022-05-20 22:53:59 +08:00
|
|
|
done
|
|
|
|
echo "export logs done"
|