Always keep alive when SSH sessions active
This commit is contained in:
@@ -54,6 +54,12 @@ server_responsive() {
|
||||
n_logins="$(w -h | wc -l)"
|
||||
echo "$(date) [$n_logins logins]"
|
||||
|
||||
if [ "$n_logins" -gt 0 ]; then
|
||||
echo "Keep alive as there are active ssh sessions"
|
||||
empty_reset
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if tmux_running; then
|
||||
: #echo "Tmux running"
|
||||
else
|
||||
@@ -65,9 +71,10 @@ fi
|
||||
if server_responsive; then
|
||||
n_players=$(mcstatus localhost json | json_parse player_count)
|
||||
echo "Server responsive. $n_players players online"
|
||||
if [ "$n_players" -gt 0 ] || [ "$n_logins" -gt 0 ]; then
|
||||
# Keep alive if players or ssh sessions active
|
||||
if [ "$n_players" -gt 0 ]; then
|
||||
# Keep alive as players are online
|
||||
empty_reset
|
||||
exit 0
|
||||
else
|
||||
empty_incr
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user