Scheduled tasks with Cron

Use Cron as a way to schedule recurring tasks for your application. When working with Cron, Amezmo manages the creation of the crontab file that is required to execute your task, and the logging of the task output so you can see the results in your Amezmo dashboard. Crons are executed from your applications current release directory.

Schedules

A cron schedule represents when the task will be executed. You may use an alias for the following cron expressions.

  • @minutely — Execute the task once every minute
  • @yearly — Execute the task once every year
  • @monthly — Execute the task once every month
  • @weekly — Execute the task once every week
  • @hourly — Execute the task once every hour

For advanced use cases, Amezmo supports POSIX cron syntax.

Scripts

A cron script is a bash script where you define your task logic. In this script, you may call into other services such as PHP, Node.js and anything you'd normally do from the command line. Scripts run on your instance and in the current working directory as your most recent release.

Best practices

It's best to use a Cron job as a means to invoke another script. Don't put any logic into your Cron job. Keep your business logic in your git repository so that any updates won't require an update to your Cron job as well.