Kinsta’s container-based infrastructure means that every site runs in a private container with its own crontab. This means that at Kinsta we allow our users to add real server cron jobs to each site container.

If you’d rather use WordPress built-in cron system please see our article on how to create and modify a WordPress cron job.

How to Write a Server Cron

A task added to crontab consists of two parts:

  1. A series of numbers and asterisks defining how frequently the cron should run.
  2. A command to be executed on the server.

When writing a cron, you’ll need to determine those two factors: the command that needs to be executed and how frequently it should be scheduled.

If you want to work out the crontab syntax yourself the crontab documentation from The Open Group is a great place to learn about crons and see some practical examples.

If you have written the command you want to add and you’d rather use a free tool generate the full crontab syntax, there are a variety of online tools you can use to generate the full command in proper crontab syntax. Crontab Generator is one of our favorite tools that can be freely used for this purpose.

How to Add a Server Cron

Once you have the cron job ready to add to the container you have two options:

To upload the job yourself, just access your site container over SSH and run this command crontab -e. Next, select your text editor of choice (select nano if you’re unsure).

Run crontab -e and then select your preferred text editor.

Run crontab -e and then select your preferred text editor.

Finally, paste the command at the end of the list.

Then close the file. When you close the file you will see a message like this confirming that the crontab has been updated:

crontab: installing new crontab

If you aren’t comfortable using SSH you can simply open a support ticket and ask Kinsta’s support team to add the job to your site’s crontab.

Kinsta Policies on Server Crons

If you enjoyed this tutorial, then you’ll love our support. All Kinsta’s hosting plans include 24/7 support from our veteran WordPress developers and engineers. Chat with the same team that backs our Fortune 500 clients. Check out our plans