mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 14:20:18 +00:00
Create temp files for working storage, log to working storage temps.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
a6caa0e680
commit
e9f1ca338f
1 changed files with 13 additions and 2 deletions
|
@ -52,7 +52,7 @@ source ${VARSFILE}
|
||||||
|
|
||||||
### Private functions exist here ###
|
### Private functions exist here ###
|
||||||
log_write() {
|
log_write() {
|
||||||
echo "${1}" >> "${DEBUG_LOG}"
|
printf "%b" "${@}" >&3
|
||||||
}
|
}
|
||||||
|
|
||||||
log_echo() {
|
log_echo() {
|
||||||
|
@ -417,7 +417,7 @@ dumpPiHoleLog() {
|
||||||
if [ -e "${PIHOLELOG}" ]; then
|
if [ -e "${PIHOLELOG}" ]; then
|
||||||
# Dummy process to use for flagging down tail to terminate
|
# Dummy process to use for flagging down tail to terminate
|
||||||
countdown &
|
countdown &
|
||||||
tail -n0 -f --pid=$! "${PIHOLELOG}" >> ${DEBUG_LOG}
|
tail -n0 -f --pid=$! "${PIHOLELOG}" >&4
|
||||||
else
|
else
|
||||||
log_write "No pihole.log file found!"
|
log_write "No pihole.log file found!"
|
||||||
printf ":::\tNo pihole.log file found!\n"
|
printf ":::\tNo pihole.log file found!\n"
|
||||||
|
@ -456,6 +456,17 @@ finalWork() {
|
||||||
}
|
}
|
||||||
|
|
||||||
### END FUNCTIONS ###
|
### END FUNCTIONS ###
|
||||||
|
# Create temporary file for log
|
||||||
|
TEMPLOG=$(mktemp /tmp/pihole_temp.XXXXXX)
|
||||||
|
# Open handle 3 for templog
|
||||||
|
exec 3>"$TEMPLOG"
|
||||||
|
# Delete templog, but allow for addressing via file handle.
|
||||||
|
rm "$TEMPLOG"
|
||||||
|
|
||||||
|
# Create temporary file for logdump using file handle 4
|
||||||
|
DUMPLOG=$(mktemp /tmp/pihole_temp.XXXXXX)
|
||||||
|
exec 4>"$DUMPLOG"
|
||||||
|
rm "$DUMPLOG"
|
||||||
|
|
||||||
# Gather version of required packages / repositories
|
# Gather version of required packages / repositories
|
||||||
version_check || echo "REQUIRED FILES MISSING"
|
version_check || echo "REQUIRED FILES MISSING"
|
||||||
|
|
Loading…
Reference in a new issue