Skip to content

Commit

Permalink
Don't shut down if somebody is logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
waldoj committed Jan 17, 2024
1 parent c156938 commit 38eeaef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions deploy/monitor_load.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]+)")"

Expand Down

0 comments on commit 38eeaef

Please sign in to comment.