From cc2de45aaebe6bc4b9aacab0621dbc0ad7a21500 Mon Sep 17 00:00:00 2001 From: Muscle Date: Fri, 17 May 2024 14:36:32 +0900 Subject: [PATCH] change AP_isRunning to APLog_isRunning --- scripts/helper_autopause.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/helper_autopause.sh b/scripts/helper_autopause.sh index 6a9ef5c00..e2baf2220 100755 --- a/scripts/helper_autopause.sh +++ b/scripts/helper_autopause.sh @@ -85,12 +85,17 @@ APLog_init() { echo -n "$$" > ${APLog_pid} } +APLog_isRunning() { + test -e ${APLog_pid} && test -p "${APLog_pipe}" +} + #------------------------------- # AutoPause Core #------------------------------- AP_startDaemon() { autopaused-ctl start + local pid pid=$(pidof knockd) APLog_debug "Start knockd pid:${pid}" } @@ -98,8 +103,8 @@ AP_startDaemon() { AP_stopDaemon() { local pid pid=$(pidof knockd) - if [ ! "${pid}" = "" ]; then - APLog_debug "Stop knockd pid:${pid}" + APLog_debug "Stop knockd pid:${pid}" + if [ -n "${pid}" ]; then autopaused-ctl stop fi } @@ -124,10 +129,6 @@ AP_isEnabled() { isTrue "${AUTO_PAUSE_ENABLED}" } -AP_isRunning() { - pidof "" -} - AP_isPaused() { test -e "${AP_pause_file}" } @@ -333,7 +334,7 @@ AutoPause_waitWakeup() { #------------------------------- AutoPauseEx_isEnabled() { - AP_isEnabled && test -e "${APLog_pid}" + AP_isEnabled && APLog_isRunning } AutoPauseEx_resume() {