Guard if no pihole-FTL.conf is present

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König
2022-04-13 21:45:11 +02:00
parent 6532f3665e
commit c942e99941

View File

@ -13,9 +13,12 @@
FTLCONFFILE="/etc/pihole/pihole-FTL.conf"
DEFAULT_PID_FILE="/run/pihole-FTL.pid"
getFTLPID() {
if [ -f "$FTLCONFFILE" ]; then
if [ -s "$FTLCONFFILE" ]; then
# if PIDFILE is not set in pihole-FTL.conf, use the default path
FTL_PID_FILE="$( (grep "^PIDFILE=" $FTLCONFFILE || echo "$DEFAULT_PID_FILE") | cut -d"=" -f2-)"
else
# if there is no pihole-FTL.conf, use the default path
FTL_PID_FILE="$DEFAULT_PID_FILE"
fi
if [ -s "${FTL_PID_FILE}" ]; then