A cron job allows you to schedule a process at a specific interval for your application. This lets you automate repetitive tasks like sending reports or performing maintenance tasks in a timed manner without a continuously running pod.

A cron job process is similar to a background worker, but only launches based on the configured timing and shuts down after finishing the required operation.

You can add a cron job when you add an application or at any time in Processes. While there is no limit to the number of cron job processes you can add, each process requires at least one pod to run.

To add a new cron job, click Create process and complete the fields as follows:

Create a croj job process.
Create a croj job process.
  • Name: The process name; for example, Marketing email scheduler.
  • Type: Choose Cron job.
  • Start command: The command required to start the process, for example, npm run [process].
  • Repeats: Choose how often you want the process to run (every minute, hour, day, week, month, or year). When you choose how often you want the process to run, you can then choose a specific minute, time, day, date, or month — depending on your first selection.
  • Pod size: This determines the CPU and RAM dedicated to the process.
  • Instances: The number of instances required, up to a maximum of 50. Each instance represents one pod, and the instances all use the same pod size. You cannot define a different pod size for each instance.

You can change the details of any process at any time, including the pod size (vertical scaling) and the number of pods running simultaneously (horizontal scaling). To learn more about changing pod size and other scaling options, see our guide on how to Scale Application Resources.

Related Documentation