Better-PaaS
Guides

Scheduled Jobs (Cron)

Run commands inside your app's container on a recurring schedule.

Sometimes you need a command to run on a schedule — database migrations, nightly cleanups, sending digest emails, generating reports. Better-PaaS has built-in cron support for exactly this.

What is cron?

"Cron" is the classic Unix way of scheduling recurring tasks. You describe when to run something using a five-field schedule, and the task runs inside your app's container at those times.

Creating a scheduled job

Go to the Cron screen in the dashboard.

Create a job and choose the app whose container the command should run in.

Enter the command to run, e.g. npm run migrate or python cleanup.py.

Enter a schedule in cron format (see below) and save.

Cron schedule format

A schedule has five fields: minute, hour, day-of-month, month, day-of-week.

┌───────────── minute (0–59)
│ ┌───────────── hour (0–23)
│ │ ┌───────────── day of month (1–31)
│ │ │ ┌───────────── month (1–12)
│ │ │ │ ┌───────────── day of week (0–6, Sunday = 0)
│ │ │ │ │
* * * * *

Some common examples:

ScheduleRuns…
0 * * * *every hour, on the hour
*/15 * * * *every 15 minutes
0 3 * * *every day at 3:00 AM
0 0 * * 0every Sunday at midnight
30 2 1 * *at 2:30 AM on the 1st of each month

Running a job right now

Need to test a job without waiting for its schedule? Use Run now on the job to execute it immediately inside the container.

Editing and deleting

Update a job's command or schedule, or delete it entirely, from the same Cron screen. Changes take effect on the next scheduled run.

Next step

On this page