From 38eeaeffbeb6ed3e4c3f322a8117c3fffebc9d0c Mon Sep 17 00:00:00 2001 From: Waldo Jaquith Date: Tue, 16 Jan 2024 20:46:00 -0500 Subject: [PATCH] Don't shut down if somebody is logged in --- deploy/monitor_load.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deploy/monitor_load.sh b/deploy/monitor_load.sh index 69fef0c..8681c2d 100755 --- a/deploy/monitor_load.sh +++ b/deploy/monitor_load.sh @@ -6,6 +6,12 @@ if [ "$UPTIME" -le 900 ]; then exit fi +# Don't shut down if somebody is logged in +USER_COUNT=$(who |wc -l) +if [ "$USER_COUNT" -gt 0 ]; then + exit +fi + # Get the load average over the past 15 minutes LOAD_AVERAGE="$(uptime | sed 's/.*load average: //' |cut -d " " -f 1 |grep -oE "([0-9]+\.[0-9]+)")"