mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
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>
This commit is contained in:
parent
484f618685
commit
e27f50b8e5
1 changed files with 7 additions and 0 deletions
|
@ -13,6 +13,13 @@ FTLUSER=pihole
|
||||||
PIDFILE=/var/run/pihole-FTL.pid
|
PIDFILE=/var/run/pihole-FTL.pid
|
||||||
|
|
||||||
get_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)}'
|
pidof "pihole-FTL" | awk '{print $(NF)}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue