mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-23 07:40:15 +00:00
Shellcheck daemon checkers
This commit is contained in:
parent
181d2fd87a
commit
a751074a6a
1 changed files with 22 additions and 21 deletions
|
@ -94,21 +94,6 @@ block_parse() {
|
||||||
log_write "${1}"
|
log_write "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
lsof_parse() {
|
|
||||||
local user
|
|
||||||
local process
|
|
||||||
|
|
||||||
user=$(echo "${1}" | cut -f 3 -d ' ' | cut -c 2-)
|
|
||||||
process=$(echo "${1}" | cut -f 2 -d ' ' | cut -c 2-)
|
|
||||||
if [[ ${2} -eq ${process} ]]; then
|
|
||||||
echo "::: Correctly configured."
|
|
||||||
else
|
|
||||||
log_echo "::: Failure: Incorrectly configured daemon."
|
|
||||||
fi
|
|
||||||
log_write "Found user ${user} with process ${process}"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
version_check() {
|
version_check() {
|
||||||
header_write "Detecting Installed Package Versions:"
|
header_write "Detecting Installed Package Versions:"
|
||||||
|
|
||||||
|
@ -270,12 +255,29 @@ ip_check() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lsof_parse() {
|
||||||
|
local user
|
||||||
|
local process
|
||||||
|
|
||||||
|
user=$(echo "${1}" | cut -f 3 -d ' ' | cut -c 2-)
|
||||||
|
process=$(echo "${1}" | cut -f 2 -d ' ' | cut -c 2-)
|
||||||
|
if [[ ${2} -eq ${process} ]]; then
|
||||||
|
echo "::: Correctly configured."
|
||||||
|
else
|
||||||
|
log_echo "::: Failure: Incorrectly configured daemon."
|
||||||
|
fi
|
||||||
|
log_write "Found user ${user} with process ${process}"
|
||||||
|
}
|
||||||
|
|
||||||
port_check() {
|
port_check() {
|
||||||
local lsof_value
|
local lsof_value
|
||||||
|
|
||||||
lsof_value=$(lsof -i ${1}:${2} -FcL | tr '\n' ' ') \
|
lsof_value=$(lsof -i "${1}":"${2}" -FcL | tr '\n' ' ')
|
||||||
&& lsof_parse "${lsof_value}" "${3}" \
|
if [[ "${lsof_value}" ]]; then
|
||||||
|| log_echo "Failure: IPv${1} Port not in use"
|
lsof_parse "${lsof_value}" "${3}"
|
||||||
|
else
|
||||||
|
log_echo "Failure: IPv${1} Port not in use"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
daemon_check() {
|
daemon_check() {
|
||||||
|
@ -284,11 +286,10 @@ daemon_check() {
|
||||||
|
|
||||||
echo "::: Checking ${2} port for ${1} listener."
|
echo "::: Checking ${2} port for ${1} listener."
|
||||||
|
|
||||||
if [[ ${IPV6_READY} ]]; then
|
if [[ $(ipv6_check) -eq 0 ]]; then
|
||||||
port_check 6 "${2}" "${1}"
|
port_check 6 "${2}" "${1}"
|
||||||
fi
|
fi
|
||||||
lsof_value=$(lsof -i 4:${2} -FcL | tr '\n' ' ') \
|
port_check 4 "${2}" "${1}"
|
||||||
port_check 4 "${2}" "${1}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
testResolver() {
|
testResolver() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue