AdGuardHome: fix log size too bit
This commit is contained in:
parent
5ef34d3dcc
commit
ccce7f2957
@ -231,6 +231,8 @@ start_service(){
|
||||
if [ $dns -eq 1 ]; then
|
||||
stop_dnscache
|
||||
sleep 1
|
||||
rm -f /var/log/dnscache.file
|
||||
rm -f /etc/AdGuardHome/data/querylog.json*
|
||||
if [ $dnscache_enable = "1" ]; then
|
||||
start_pdnsd
|
||||
elif [ $dnscache_enable = "2" ]; then
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
sleeptime=60
|
||||
logfile="/var/log/dnscache.file"
|
||||
adg_logfile="/etc/AdGuardHome/data/querylog.json"
|
||||
dns_enable=$(uci get flowoffload.@flow[0].dns 2>/dev/null)
|
||||
dnscache_enable=$(uci get flowoffload.@flow[0].dnscache_enable 2>/dev/null)
|
||||
|
||||
@ -11,7 +12,12 @@ if [ $logrow -ge 500 ];then
|
||||
cat /dev/null > ${logfile}
|
||||
echo "$curtime Log条数超限,清空处理!" >> ${logfile}
|
||||
fi
|
||||
|
||||
if [ $dnscache_enable = "3" ];then
|
||||
adg_logrow=$(grep -c "" ${adg_logfile})
|
||||
if [ $logrow -ge 500 ];then
|
||||
cat /dev/null > ${adg_logfile}
|
||||
echo "$curtime Log条数超限,清空处理!" >> ${adg_logfile}
|
||||
fi
|
||||
}
|
||||
|
||||
while [ $dns_enable -eq 1 ];
|
||||
@ -19,23 +25,24 @@ do
|
||||
curtime=`date "+%H:%M:%S"`
|
||||
echo "$curtime online! "
|
||||
if [ $dns_enable -eq 1 ]; then
|
||||
if [ $dnscache_enable = "3" ]; then
|
||||
if ! pidof AdGuardHome>/dev/null; then
|
||||
if [ $dnscache_enable = "3" ];then
|
||||
if ! pidof AdGuardHome>/dev/null;then
|
||||
AdGuardHome -c /etc/AdGuardHome/AdGuardHome.yaml -w /etc/AdGuardHome >/dev/null 2>&1 &
|
||||
echo "$curtime 重启服务!" >> ${logfile}
|
||||
fi
|
||||
else
|
||||
if ! pidof dnscache>/dev/null; then
|
||||
if [ $dnscache_enable = "1" ]; then
|
||||
/usr/sbin/dnscache -c /var/etc/dnscache.conf -d
|
||||
elif [ $dnscache_enable = "2" ]; then
|
||||
dnscache -f /var/run/dnscache/dnscache.conf -d
|
||||
if [ $dnscache_enable = "1" ];then
|
||||
/usr/sbin/dnscache -c /var/etc/dnscache.conf -d
|
||||
elif [ $dnscache_enable = "2" ];then
|
||||
dnscache -f /var/run/dnscache/dnscache.conf -d
|
||||
fi
|
||||
echo "$curtime 重启服务!" >> ${logfile}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
clean_log
|
||||
sleep ${sleeptime}
|
||||
continue
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue
Block a user