1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-23 07:18:07 +00:00

fixes #1537 by checking if systemctl is found

Signed-off-by: Jacob Salmela <github@decoy.email>
This commit is contained in:
Jacob Salmela 2017-12-08 18:23:55 -06:00
parent 863ea7294f
commit 6f03e30151
No known key found for this signature in database
GPG Key ID: 1962FF1A5046135E

View File

@ -212,7 +212,7 @@ copy_to_debug_log() {
# uploaded to our server, since it can't properly display in color # uploaded to our server, since it can't properly display in color
# This is accomplished by use sed to remove characters matching that patter # This is accomplished by use sed to remove characters matching that patter
# The entire file is then copied over to a sanitized version of the log # The entire file is then copied over to a sanitized version of the log
sed 's/\[[0-9;]\{1,5\}m//g' > "${PIHOLE_DEBUG_LOG_SANITIZED}" <<< cat "${PIHOLE_DEBUG_LOG}" # sed 's/\[[0-9;]\{1,5\}m//g' > "${PIHOLE_DEBUG_LOG_SANITIZED}" <<< cat "${PIHOLE_DEBUG_LOG}"
} }
initiate_debug() { initiate_debug() {
@ -809,8 +809,14 @@ process_status(){
local i local i
# For each process, # For each process,
for i in "${PIHOLE_PROCESSES[@]}"; do for i in "${PIHOLE_PROCESSES[@]}"; do
# get its status via systemctl # If systemd
local status_of_process=$(systemctl is-active "${i}") if command -v systemctl &> /dev/null; then
# get its status via systemctl
local status_of_process=$(systemctl is-active "${i}")
else
# Otherwise, use the service command
local status_of_process=$(service "${i}" status | awk '/Active:/ {print $2}') &> /dev/null
fi
# and print it out to the user # and print it out to the user
if [[ "${status_of_process}" == "active" ]]; then if [[ "${status_of_process}" == "active" ]]; then
# If it's active, show it in green # If it's active, show it in green