7月3日
# es2
version: '3'
services:
es:
image: my-es:2
ports:
- "9200:9200"
- "9300:9300"
- "5678:5601"
container_name: es2
cap_add:
- ALL
privileged: true
networks:
esnet:
ipv4_address: '172.40.0.2'
restart: "on-failure"
networks:
esnet:
ipam:
config:
- subnet: "172.40.0.0/16"
7月4号
- check_big_file脚本优化
- 配置两个禅道外网连接
- mynote-tp, pjkdocker 两个服务器,将nginx日志按天分隔
/etc/crontab
0 0 * * * root /bin/bash /usr/local/nginx/nginxlogscut.sh >> /dev/null 2>&1
#!/bin/bash
nginxPath="/usr/local/nginx/"
YESTERDAY=$(date -d "-1day" +%Y-%m-%d)
backLogDirs=()
saveMaxDay=30
isAbsolutePath(){
if [ $(echo $1 | grep ^/|wc -l) -eq 1 ];then
echo true
return
fi
echo false
}
results=$(grep -E 'access_log|error_log' ${nginxPath}conf/vhost/*.conf)
OLD_IFS=$IFS
IFS=";"
for log in $results;do
IFS="${OLD_IFS}"
logPath=$(echo -n $log | awk '{print $3}')
if ! $(isAbsolutePath $logPath);then
logPath="$nginxPath$logPath"
fi
backLogName=$(basename ${logPath}|sed -r "s#(.*).log#\1_${YESTERDAY}.log#")
backLogPath="$(dirname ${logPath})/logs/${backLogName}"
dir=$(dirname $backLogPath)
if ! [[ "${backLogDirs[@]}" =~ "$dir" ]];then
[ ! -d $dir ] && mkdir $dir
backLogDirs[${#backLogDirs[@]}]=$dir
fi
mv $logPath $backLogPath
gzip $backLogPath
done
# kill -USR1 $(cat /usr/local/nginx/logs/nginx.pid)
/usr/local/nginx/sbin/nginx -s reopen
# clear
if [ ${#backLogDirs[@]} -eq 0 ];then
return
else
if ! [[ ${backLogDirs[@]} =~ "logs" ]];then
return
fi
fi
find ${backLogDirs[@]} -mtime +$saveMaxDay -f -exec rm -f {} \;