Enabling cron job

Hi @michael Can you please help me on how to enable CronJob in my local machine for DevKinsta?

If i run ‘crontab -e’ its showing command not found.

root@fffe3743e04a:/www/kinsta/public# crontab -e
bash: crontab: command not found

When i see it in my wordpress backend, i got the below.

Hi @Saravana_Kumar . I hope you don’t mind. I’ve moved your post into a new thread to avoid confusion with the other one.

I’m afraid crontab/cron jobs are not enabled by default on our Docker environment. Typically this wouldn’t be something you want enabled for the local environment. With a bit of tweaking, it’s certainly possible to do.

As for the cron events failing locally, would you happen to have crons disabled via wp-config.php? It’s also possible code contained within the site (plugin or theme) is preventing crons from functioning properly.

You can use WP-CLI for this from devkinsta_fpm container.

Login to container shell using
#docker exec -it devkinsta_fpm bash

After this navigate to your project directory
#cd /www/kinsta/public/[your-project-name]
and run
#wp cron event run --due-now --allow-root

You will have to repeat this or use the watch command to run it every x seconds if you want that. But for development purposes running it manually it is not a big issue I think.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.