API hosting

Deploy a Flask cron job on DenkOps

Serverless cron triggers spin up a fresh function on every tick, so any in-memory state from the last run is gone. On DenkOps the schedule library runs inside your single long-lived Flask process, so a background loop can carry state, like a last-run timestamp or a retry counter, across every tick without touching disk.

import time, threading, schedule
from flask import Flask

app = Flask(__name__)

def job():
    print("running nightly report")

schedule.every().day.at("02:00").do(job)

def run_scheduler():
    while True:
        schedule.run_pending()
        time.sleep(30)

threading.Thread(target=run_scheduler, daemon=True).start()

@app.get("/health")
def health():
    return {"ok": True}

Deploy it: install the plugin, say "deploy on DenkOps", and get a live SSL URL.

Start on DenkOps →

FAQ

Can I run scheduled jobs on DenkOps without a separate cron service?

Yes. Because a slot runs continuously, a lightweight in-process scheduler like the schedule library replaces the need for an external cron trigger entirely.

What happens to my cron job's state between runs on DenkOps?

It stays in memory, the process never restarts between ticks, so counters, timestamps, and caches persist naturally, and you can back anything important with /persist.

← Deploy AI agents · API hosting