# Run a Python script or worker 24/7

> Keep a Python script, a scheduled job or a queue worker running day and night on servers in the EU, straight from GitHub. Free while you build it, 2 EUR a month to keep it running.

Web page: https://blitz.cloud/guides/run-python-script-24-7/
Updated: 2026-11-04

A price watcher that checks a shop every ten minutes. A scraper that fills a database overnight. A worker that takes jobs off a Redis queue, or an AI agent that reads your inbox and writes a summary at seven. None of these need a web page. They need a machine that doesn't switch off when you close your laptop.

On blitz.cloud the script comes from your GitHub repository and runs in the background on servers in the EU. Every push builds a new version.

## Can it run 24/7 for free?

No. On the free plan a background script runs while you are working on it: it stops a day or two after your last sign-in or deploy, and Start runs it again. That is fine for trying it out, not for a job that has to run on Sunday morning while you're away.

To keep it running day and night, make it a **Pro app** for 2 EUR a month or 15 EUR a year. With several scripts, **Pro** at 7 EUR a month runs as many as you like.

## Write it as a long-running process

blitz.cloud has no separate cron service. A script that should run on a schedule stays alive and does its own timing. With the `schedule` package that is a few lines:

```python
import time
import schedule

def check_prices():
    print("checking prices", flush=True)
    # your code here

schedule.every(10).minutes.do(check_prices)
schedule.every().day.at("06:00").do(check_prices)  # the server clock is UTC

while True:
    schedule.run_pending()
    time.sleep(30)
```

APScheduler works the same way and takes cron-style rules and time zones; add `tzdata` to `requirements.txt` if you use one. A queue worker needs no scheduler at all: it waits on the queue in a loop.

Print with `flush=True`, or start Python with `-u`, so your output shows up in the Logs tab straight away.

## Put it online

1. Push the script to GitHub with a `requirements.txt`.
2. Sign up, click "Host something new", then "My own code", and pick the repository.
3. When you name the app, switch on "Runs in the background". It gets no address, never goes to sleep and we don't wait for it to answer on a port.
4. Put API keys and passwords on the app's Environment tab. They are encrypted before they are stored and reach the script as environment variables, such as `os.environ["API_KEY"]`.
5. Build it and watch the Logs tab.
6. When it does what it should, open its page and click "Make it a Pro app".

Without a Dockerfile we write one from what is in the repository. If you want to decide yourself, this is enough:

```dockerfile
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "-u", "main.py"]
```

## Where the results go

Files the script writes are thrown away when it restarts, unless they are in one of the app's kept folders. For anything you want to keep, a database is the better place. Create a PostgreSQL, MariaDB or Redis database on the Databases page and connect it. The address arrives as `DATABASE_URL` or similar, only your own apps can reach it, and it is backed up every night.

## What each option gives you

| | Free | Pro app | Pro |
|---|---|---|---|
| Price | 0 EUR | 2 EUR a month or 15 EUR a year | 7 EUR a month or 70 EUR a year |
| Background script runs | While you work on it, stops a day or two after your last sign-in or deploy | Day and night | Day and night |
| How many | One at a time | This one, with its own memory and database | As many as you like, up to 50 apps |
| Nightly copies of kept folders | No | No | Yes |

Not what you needed? Ask within 30 days of your first payment and we refund the first month.

## Questions

### Can I run a Python script 24/7 for free?

Not on blitz.cloud. Free background scripts stop a day or two after your last sign-in or deploy. Running one for good costs 2 EUR a month as a Pro app.

### Is there a cron job feature?

No separate one. The script runs all the time and keeps its own schedule with `schedule`, APScheduler or a plain loop with `time.sleep`.

### What if the script crashes?

It is started again on its own. If it crashes again and again, its page in the dashboard shows the last lines it printed, and the Logs tab has the rest.

### Does it work for Node.js, Go or other languages?

Yes. Anything that builds into a Docker image for x86 runs the same way. Without a Dockerfile we write one from `package.json`, `go.mod` and the like.

### Where does it run?

On blitz.cloud's servers in the EU, run by BlitzWorks, a company in Germany.

## Get your script running

[Sign up](https://dashboard.blitz.cloud/auth/login?register=1), pick the repository and switch on "Runs in the background". Once the logs look right, click "Make it a Pro app" and it runs day and night for 2 EUR a month.
