title: How do I keep a script running forever on repl.it?
body: <p>I have a Python Scipt running over on repl.it, but I assume it stops when I close the tab, since I don't own a Premium (&quot;Hacker&quot;) account. When hosting my Discord Bot, I tried to add a piece of python that SHOULD make it run forever. Why SHOULD? I checked on it a few days ago, it was offline :-/ But confusingly, this setup worked a whole bunch of time (about half a year), except since a few days ago.</p>
  <p>piece of extra Python (webapp.py):</p>
  <pre><code>from flask import Flask
  from threading import Thread
  import datetime
  
  app = Flask(__name__)
  
  @app.route('/')
  def main_func():
      
      content = &quot;&lt;p&gt;&quot; + &quot;Online @ &quot; + str(datetime.datetime.now()) + &quot;&lt;/p&gt;&quot;
      return content
  
  def run():
      app.run(host=&quot;0.0.0.0&quot;, port=8080)
  
  def keep_alive():
      server = Thread(target=run)
      server.start()
  </code></pre>
  <p>actual discord bot (main.py)</p>
  <pre><code>from webapp import keep_alive
  import discord
  
  # discord bot stuff
  client = discord.Client()
  
  keep_alive()
  
  client.run() # run discord bot
  </code></pre>
  <p>Then I pinged the now running server (webbap.py) using <a href="https://uptimerobot.com" rel="nofollow noreferrer">Uptimerobot</a> which, as said, worked fine a long time.
  (Whats happening here is, that the uptimerobot pings the site every 5 mins, which should cause it to not go to sleep, since there is a limit (30 mins after last HTTP traffic) when exceeding, the server goes to sleep)
  My question now is, was that just an accident? I have a new project now, which involves web-scraping data for a longer period of time (around 4 months) automatically. That project script needs to be running 24/7 without any exception.</p>