input: from typing import Tuple
  import psycopg2
  from datetime import datetime, timedelta
  import schedule
  import time
  
  def refresh_table_periodically(host: str, database: str, user: str, password: str, table_name: str) -> Tuple[bool, str]:
      """
      Refreshes a specified table in a PostgreSQL database every 5 minutes.
      Returns a tuple with a boolean indicating success and a message string.
  
      >>> refresh_table_periodically("localhost", "db", "user", "password", "TableName")
      (True, "Table refresh job scheduled successfully.")
      >>> refresh_table_periodically("invalid_host", "db", "user", "password", "TableName")
      (False, "An error occurred while connecting to the database.")
      """
      try:
          conn = psycopg2.connect(host=host, database=database, user=user, password=password)
          def refresh_data():
              cur = conn.cursor()
              query = f'REFRESH TABLE "{table_name}";'
              cur.execute(query)
              conn.commit()
  
          # Schedule the refresh_data job every 5 minutes
          schedule.every(5).minutes.do(refresh_data)
  
          while True:
              schedule.run_pending()
              time.sleep(1)
  
          return (True, "Table refresh job scheduled successfully.")
      except Exception as e:
          return (False, f"An error occurred while connecting to the database: {e}")
output:     finally:
          if conn:
              conn.close()