From ff6df76e3612483c693bbc6b2b2d1bd663cb75e4 Mon Sep 17 00:00:00 2001 From: gedetil Date: Tue, 11 Apr 2017 12:04:44 -0500 Subject: [PATCH 1/3] Update webpage.sh Implement "Halt system" button, next to "Restart system" button, on admin/settings page. Useful for doing clean shutdown before powering off. (This affects 4 files, 3 for the web content, 1 for backend script.) Gilbert Detillieux 2017-04-11 --- advanced/Scripts/webpage.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 7804fc8f..4247ee54 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -211,6 +211,10 @@ SetExcludeClients(){ } +Halt(){ + nohup bash -c "sleep 5; halt" &> /dev/null /dev/null Date: Fri, 8 Sep 2017 19:33:06 +0200 Subject: [PATCH 2/3] Use `poweroff` instead of `halt` Signed-off-by: DL6ER --- advanced/Scripts/webpage.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index ae115aed..4441575f 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -217,8 +217,8 @@ SetExcludeClients() { change_setting "API_EXCLUDE_CLIENTS" "${args[2]}" } -Halt(){ - nohup bash -c "sleep 5; halt" &> /dev/null /dev/null Date: Fri, 8 Sep 2017 19:35:05 +0200 Subject: [PATCH 3/3] Update to comply with current development code Signed-off-by: DL6ER --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 4441575f..fbba3f74 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -234,8 +234,8 @@ RestartDNS() { output=$( { service dnsmasq restart; } 2>&1 ) fi - if [[ "$?" == 0 ]]; then - echo -e "${OVER} ${TICK} ${str}" + if [[ -z "${output}" ]]; then + [[ -t 1 ]] && echo -e "${OVER} ${TICK} ${str}" else [[ ! -t 1 ]] && OVER="" echo -e "${OVER} ${CROSS} ${output}"