Try to obtain PID from PIDFILE. If this fails (file does not exist or is empty), fall back to using pidof + awk

Signed-off-by: DL6ER <dl6er@dl6er.de>
pull/2767/head
DL6ER 5 years ago
parent f6213d4f4d
commit ae98fde321
No known key found for this signature in database
GPG Key ID: FB60471F0575164A

@ -13,6 +13,13 @@ FTLUSER=pihole
PIDFILE=/var/run/pihole-FTL.pid
get_pid() {
# First, try to obtain PID from PIDFILE
if [ -s "${PIDFILE}" ]; then
cat "${PIDFILE}"
return
fi
# If the PIDFILE is empty or not available, obtain the PID using pidof
pidof "pihole-FTL" | awk '{print $(NF)}'
}

Loading…
Cancel
Save