Skip to main content

Cron Jobs

A scheduled method or a cron job is a method that will run periodically. By using a specific cron syntax, you can define the frequency and timing for each method.

With genezio decorators, you can set the method type to cron and the cronString accordingly to the desired frequency.

Use scheduled methods in your project

In the example below, the method sayHiEveryMinute() will be called every minute:

import { GenezioDeploy, GenezioMethod } from "@genezio/types";

export class BackendService {
@GenezioMethod({ type: "cron", cronString: "* * * * *" })
sayHiEveryMinute() {

Cron strings examples

Below, you have the most commonly used cronString examples:

Cron stringDescription
* * * * *Triggers at every minute
0/5 * * * *Triggers every 5 minutes
0 * * * *Triggers every hour
0 8 * * *Triggers every day at 8 a.m.

You can, also, use to build specific cron strings.

Examples using scheduled methods


For more details, check out an example using scheduled methods.

More details

For more information on genezio decorators, check out genezio-decorators.

Next Steps

Also, you can find more details on deploying the backend and frontend here:

Now you are ready for some more advanced use cases: