Remove obsolet getFTLPIDFile()

We can get the path of the PID file via getFTLConfigValue files.pid

Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
Christian König
2024-07-27 21:55:18 +02:00
parent 15d7fab2cb
commit 2c32d485bd
6 changed files with 9 additions and 60 deletions
-19
View File
@@ -81,25 +81,6 @@ removeKey() {
sed -i "/^${key}/d" "${file}"
}
#######################
# returns path of FTL's PID file
#######################
getFTLPIDFile() {
local FTLCONFFILE="/etc/pihole/pihole-FTL.conf"
local DEFAULT_PID_FILE="/run/pihole-FTL.pid"
local FTL_PID_FILE
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
echo "${FTL_PID_FILE}"
}
#######################
# returns FTL's PID based on the content of the pihole-FTL.pid file
#
+2 -2
View File
@@ -1,13 +1,13 @@
#!/usr/bin/env sh
# Source utils.sh for getFTLPIDFile()
# Source utils.sh for getFTLConfigValue()
PI_HOLE_SCRIPT_DIR='/opt/pihole'
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
# shellcheck disable=SC1090
. "${utilsfile}"
# Get file paths
FTL_PID_FILE="$(getFTLPIDFile)"
FTL_PID_FILE="$(getFTLConfigValue files.pid)"
# Cleanup
rm -f /run/pihole/FTL.sock /dev/shm/FTL-* "${FTL_PID_FILE}"
+2 -2
View File
@@ -1,13 +1,13 @@
#!/usr/bin/env sh
# Source utils.sh for getFTLPIDFile()
# Source utils.sh for getFTLConfigValue()
PI_HOLE_SCRIPT_DIR='/opt/pihole'
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
# shellcheck disable=SC1090
. "${utilsfile}"
# Get file paths
FTL_PID_FILE="$(getFTLPIDFile)"
FTL_PID_FILE="$(getFTLConfigValue files.pid)"
# Ensure that permissions are set so that pihole-FTL can edit all necessary files
# shellcheck disable=SC2174
+2 -2
View File
@@ -9,7 +9,7 @@
# Description: Enable service provided by pihole-FTL daemon
### END INIT INFO
# Source utils.sh for getFTLPIDFile(), getFTLPID()
# Source utils.sh for getFTLConfigValue(), getFTLPID()
PI_HOLE_SCRIPT_DIR="/opt/pihole"
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
# shellcheck disable=SC1090
@@ -98,7 +98,7 @@ status() {
trap 'cleanup; exit 1' INT HUP TERM ABRT
# Get FTL's PID file path
FTL_PID_FILE="$(getFTLPIDFile)"
FTL_PID_FILE="$(getFTLConfigValue files.pid)"
# Get FTL's current PID
FTL_PID="$(getFTLPID "${FTL_PID_FILE}")"