I Set a Cron Job but Nothing Works

Hi there,

I had an issue about setting cron jobs on CyberPanel. I wanna set a cron job executes at 3.30 a.m. everyday. So, when I define the values as " */30 */03 * * * wget -q -O - https://artpropromosyon.com/wp-content/plugins/entsidebyside/trigger.php >/dev/null 2>&1" respectively, nothing happening at 3.30 .

I tested that ‘trigger.php’ fiile on other hosting which uses Cpanel and applied some cron jobs on it. It works properly. The file contains some kind of wordpress core functions such as ‘update_post_meta(), set_object_terms()’ and I don’t think there is any programmatical mistake.

Screenshot is below, any help is appreciated.

Hello @wordpress_developer Happy you are here

Are you running Wordpress with LS Cache?

Hello, thanks.

My website use Litespeed; so, if LS Cache is a built-in functionality then yes I run it. But I don’t use any caching plugin.

Add the following to your .htaccess

<FilesMatch "(wp-cron.php)$">
Satisfy Any
Order allow,deny
Allow from all
Deny from none
</FilesMatch>

Thank you, I tried but it didn’t work. Maybe I should change ‘wp-cron.php’ with ‘trigger.php’ in this code?

Because I didn’t declared any wordpress own crons using wp_schedule_event() . Instead, I’m trying to execute the php file by server based crons.

Right I got the question wrong:

  1. Add the following line to the wp-config.php file:

define('DISABLE_WP_CRON', true);

  1. Set up a real cron job that runs at fixed intervals regardless of site traffic:

cd /home/mywordpresswebsite.net/public_html; /usr/local/bin/php -q wp-cron.php

In your case: wget -q -O - 'https://artpropromosyon.com/wp-content/plugins/entsidebyside/trigger.php' >/dev/null 2>&1

Check for the cronjob errors grep “trigger.php” /var/log/cron
OR setup the cronjob as:
wget -q -O - 'https://artpropromosyon.com/wp-content/plugins/entsidebyside/trigger.php' >> /var/log/entsidebysidejob.log 2>&1
OR grep CRON /var/log/syslog
OR journalctl | grep cron

1 Like

I appreciated a lot for your help. After I added ‘define(‘DISABLE_WP_CRON’, true);’ , I defined new cron job using ‘curl’ method this time. So, the whole command I typed is curl https://artpropromosyon.com/wp-content/plugins/entsidebyside/trigger.php > /dev/null 2>&1 . I added this cron job on CyberPanel with hour-min configs and it is working properly currently.

I’ll observe it for the next few times of course. But for now, the problem is solved! Thanks again.

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