Always keep alive when SSH sessions active

This commit is contained in:
2020-07-04 23:36:23 +02:00
parent 923b4781ee
commit ac9aefd331

View File

@@ -54,6 +54,12 @@ server_responsive() {
n_logins="$(w -h | wc -l)" n_logins="$(w -h | wc -l)"
echo "$(date) [$n_logins logins]" 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 if tmux_running; then
: #echo "Tmux running" : #echo "Tmux running"
else else
@@ -65,9 +71,10 @@ fi
if server_responsive; then if server_responsive; then
n_players=$(mcstatus localhost json | json_parse player_count) n_players=$(mcstatus localhost json | json_parse player_count)
echo "Server responsive. $n_players players online" echo "Server responsive. $n_players players online"
if [ "$n_players" -gt 0 ] || [ "$n_logins" -gt 0 ]; then if [ "$n_players" -gt 0 ]; then
# Keep alive if players or ssh sessions active # Keep alive as players are online
empty_reset empty_reset
exit 0
else else
empty_incr empty_incr
exit 1 exit 1