Respect custom PID file location

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

View File

@ -10,8 +10,14 @@
### END INIT INFO
# Get PID of main pihole-FTL process
FTL_PID_FILE="/run/pihole-FTL.pid"
FTLCONFFILE="/etc/pihole/pihole-FTL.conf"
DEFAULT_PID_FILE="/run/pihole-FTL.pid"
getFTLPID() {
if [ -f "$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-)"
fi
if [ -s "${FTL_PID_FILE}" ]; then
# -s: FILE exists and has a size greater than zero
FTL_PID="$(cat "$FTL_PID_FILE")"