Show your support by giving us a star!

Cron Jobs

Cron jobs are scheduled tasks in Unix-like operating systems. They are used to automate system maintenance or administration tasks, such as backups, system updates, or routine data processing.

Dosei offers an opinionated approach to its use in Infrastructure as Code (IaC) for ease of use. Here, you can learn how to get started with Dosei Cron Jobs.

Dosei Cron Jobs follow the same lifecycle of your project with versions following your git history, just like in your regular application source code, you can easil rollback a cron job.

Dosei Cron Jobs use the same environment variables define in your project.

Getting started

  1. Install the Dosei SDK in your project if you haven't already.
# Install the Dosei Python SDK
pip install dosei-sdk
  1. Add A CronJob function to your dosei app
from dosei_sdk import Dosei

dosei = Dosei()

@dosei.cron_job("0 0 * * *")
def hello_world():
print("hello world!")

Now next time you roll out a new deployment, your new define cron jobs will be displayed under the Cron Jobs tab in your project page.

Running Cron Jobs locally

You can also run the cron jobs locally, simply run on your terminal

#         module:func_name
dosei run hello_world.main:hello_world

Pricing

Cron jobs are individual definitions of functions set to execute code. Each definition counts as one cron job, and execution time is billed separately.

FoundationProEnterprise
10 /month included; then $0.10 /each50 /month included; then $0.10/eachUnlimited; Volume discounts available

Was this page helpful?