#!/bin/bash
WEBNAME=(www_domain)
LOGTYPE=(error access)
SERPATH=/usr/local/nginx
LOGPATH=${SERPATH}/logs
BINPATH=${SERPATH}/sbin/nginx
DATETIME=$(date +%F)
function reloading(){
${SERPATH}/sbin/nginx -s reload
}
function cuter(){
for name in ${!WEBNAME[*]}
do
for num in ${!LOGTYPE[*]}
do
mv ${LOGPATH}/${LOGTYPE[${num}]}_${WEBNAME[${name}]}.log \
${LOGPATH}/${DATETIME}_${LOGTYPE[${num}]}_${WEBNAME[${name}]}.log
done
done
reloading
}
function clearlog(){
find ${LOGPATH} -type f -name "*.log" -atime +7 \
|xargs rm -f
}
cuter
#clearlog
版权归属:
admin
许可协议:
本文使用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》协议授权
评论区