mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-03-12 03:38:29 +00:00
Add webserver log to piholeLogFlush.sh
Signed-off-by: Jack'lul <8418678+jacklul@users.noreply.github.com>
This commit is contained in:
parent
9fe687bd62
commit
4df5c0bb96
1 changed files with 29 additions and 0 deletions
|
@ -35,6 +35,10 @@ FTLFILE=$(getFTLConfigValue "files.log.ftl")
|
|||
if [ -z "$FTLFILE" ]; then
|
||||
FTLFILE="/var/log/pihole/FTL.log"
|
||||
fi
|
||||
WEBFILE=$(getFTLConfigValue "files.log.webserver")
|
||||
if [ -z "$WEBFILE" ]; then
|
||||
WEBFILE="/var/log/pihole/webserver.log"
|
||||
fi
|
||||
|
||||
if [[ "$*" == *"once"* ]]; then
|
||||
# Nightly logrotation
|
||||
|
@ -71,6 +75,17 @@ if [[ "$*" == *"once"* ]]; then
|
|||
if [[ "$*" != *"quiet"* ]]; then
|
||||
echo -e "${OVER} ${TICK} Rotated ${FTLFILE} ..."
|
||||
fi
|
||||
# Copy webserver.log over to webserver.log.1
|
||||
# and empty out webserver.log
|
||||
if [[ "$*" != *"quiet"* ]]; then
|
||||
echo -ne " ${INFO} Rotating ${WEBFILE} ..."
|
||||
fi
|
||||
cp -p "${WEBFILE}" "${WEBFILE}.1"
|
||||
echo " " > "${WEBFILE}"
|
||||
chmod 640 "${WEBFILE}"
|
||||
if [[ "$*" != *"quiet"* ]]; then
|
||||
echo -e "${OVER} ${TICK} Rotated ${WEBFILE} ..."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# Manual flushing
|
||||
|
@ -103,6 +118,20 @@ else
|
|||
echo -e "${OVER} ${TICK} Flushed ${FTLFILE} ..."
|
||||
fi
|
||||
|
||||
# Flush both webserver.log and webserver.log.1 (if existing)
|
||||
if [[ "$*" != *"quiet"* ]]; then
|
||||
echo -ne " ${INFO} Flushing ${WEBFILE} ..."
|
||||
fi
|
||||
echo " " > "${WEBFILE}"
|
||||
chmod 640 "${WEBFILE}"
|
||||
if [ -f "${WEBFILE}.1" ]; then
|
||||
echo " " > "${WEBFILE}.1"
|
||||
chmod 640 "${WEBFILE}.1"
|
||||
fi
|
||||
if [[ "$*" != *"quiet"* ]]; then
|
||||
echo -e "${OVER} ${TICK} Flushed ${WEBFILE} ..."
|
||||
fi
|
||||
|
||||
if [[ "$*" != *"quiet"* ]]; then
|
||||
echo -ne " ${INFO} Flushing database, DNS resolution temporarily unavailable ..."
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue