From b08fe2c749a992ed535a3b610cf1caf7e0493735 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 12 Feb 2022 20:55:17 +0100 Subject: [PATCH] no sleep when ssh --- bundles/wol-sleeper/files/suspend_if_idle | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bundles/wol-sleeper/files/suspend_if_idle b/bundles/wol-sleeper/files/suspend_if_idle index 2355bbb..1519321 100644 --- a/bundles/wol-sleeper/files/suspend_if_idle +++ b/bundles/wol-sleeper/files/suspend_if_idle @@ -1,7 +1,7 @@ #!/bin/bash UPTIME=$(cat /proc/uptime | cut -d. -f1) -MIN_UPTIME=$(expr 60 \* 10) +MIN_UPTIME=$(expr 60 \* 20) if [[ "$UPTIME" -lt "$MIN_UPTIME" ]] then echo "ABORT: uptime ($UPTIME) lower than min ($MIN_UPTIME)" @@ -21,7 +21,7 @@ do fi done -LOGINS=$(who -u | grep pts\/ | wc -l) +LOGINS=$(netstat -tnpa | grep 'ESTABLISHED.*sshd' | wc -l) if [[ "$LOGINS" -gt 0 ]] then echo "ABORT: $LOGINS user logins" @@ -31,9 +31,7 @@ fi if [[ "$1" = now ]] then echo "SESPENDING" - sleep 10 systemctl suspend else echo "WOULD SESPEND" - sleep 300 fi