mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Merge pull request #1818 from pi-hole/fix/debug
Use systemctl or service commands in debug script
This commit is contained in:
commit
6c9e7586d5
1 changed files with 8 additions and 2 deletions
|
@ -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
|
||||||
|
# If systemd
|
||||||
|
if command -v systemctl &> /dev/null; then
|
||||||
# get its status via systemctl
|
# get its status via systemctl
|
||||||
local status_of_process=$(systemctl is-active "${i}")
|
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
|
||||||
|
|
Loading…
Reference in a new issue