lib/sbpanel/game.rb
# Detect server status
# Looks for processes which have log file open for writing
Detect server status
Looks for processes which have log file open for writing
Detect server status Looks for processes which have log file open for writing
def update_status!
      status = :online
      if !is_port_open?(@address, @port)
        status = :offline
      end
      if status != @status
        time = Time.now
        if status == :offline
          puts "Server is currently offline"
        else
          puts "Server is currently online"
        end
        @status = status
        if @status == :online
          @last_status_change = @last_launch
        else
          @last_status_change = time
        end
      end
    end
def update_status! status = :online if ! is_port_open? ( @address , @port ) status = :offline end if status != @status time = Time . now if status == :offline puts "Server is currently offline" else puts "Server is currently online" end @status = status if @status == :online @last_status_change = @last_launch else @last_status_change = time end end end
Detect server status
Looks for processes which have log file open for writing
Detect server status Looks for processes which have log file open for writing