• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue wp cron job

karimwael

New Pleskian
hello
iam new here just migrated to vultr+plesk from wordpress hosting

i have 2 command lines regarding cron job which were on my old host server "cloudways " those lines are

* * wget -q -O - https://mydomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
* * * * * wget -q -O - https://mydomain.com/wp-json/woofunnels/v1/worker
how can i add them in the plesk cron?

i followed some tutorial but not sure if its right or not

these what i did :
1/
Task Type: Fetch a URL:
Run: Cron Style, 1-56/5 * * * *
Description: Wordpress Cron
Notify: Do not notify

2/

Task Type: Fetch a URL:
Run: Cron Style,* * * * *
Description: woofunnel cron
Notify: Do not notify

is this right?
thanks
 
Yes, this looks good. Not sure about the -O parameter in your original command though. That would normally be followed by a filename, but no file name follows there, so not sure why that parameter was used.
 
Yes, this looks good. Not sure about the -O parameter in your original command though. That would normally be followed by a filename, but no file name follows there, so not sure why that parameter was used.
thank you
is there a way to check if my wordpress is wokring fine using these commands?
 
thank you
is there a way to check if my wordpress is wokring fine using these commands?
The WP cron is just a drop-in replacement for the built-in Wordpress cron algorithm that ensures that internal tasks are executed regularly even if the site has no visitors. Else WP would execute the same tasks when someone visits the site and "time is up". So WP will not fail just because the cronjob might fail.

You can test your jobs by clicking the "Run Now" button. If they do not throw errors, you are good. If there are errors, they are reported in the execution log window.
 
the second command original version is : "
* * * * * curl https://example.com/wp-json/woofunnels/v1/worker
if this may help you i didnt add the curl on the command

i have another question " what is the difference between the two types : run a command & fetch url ? which one i should use?
sorry iam completley new to this !
Fetch URL is the right thing for your, because you are executing commands by requesting an URL. If you would want to run a script directly, without using a web server request, then you'd choose "run command" or "run PHP script" and provide the path and script name and - if needed - parameters. But for your two URLs mentioned above, the "Fetch URL" option is correct.
 
sorry iam completley new to this !
And if you had a 1,000 questions on the product, please feel free to post them all anyway. Plesk staff will always try to help. Your questions and the threads that develop from them also help other users who will then find great answers, because you once asked the question.
 
And if you had a 1,000 questions on the product, please feel free to post them all anyway. Plesk staff will always try to help. Your questions and the threads that develop from them also help other users who will then find great answers, because you once asked the question.
thank you peter , i appreciate your help!
 
It means that from minute 1 through 56 in every hour on every day the job is executed every five minutes. You may think it is the same like */5 * * * *, but it is not. In your set-up, the job is run on minute 1, 6, 11, 16, 21 etc. while in the typical */5 syntax it is on in minute 0, 5, 10, 15, 20 etc. The way you put it is a good thing, because that way your two jobs will not run at the same time so that your server experiences less load peaks.
 
Hello @Peter Debik ,

First of all THANK YOU so much for such a great support, really appreciated.

i disabled wp cron from wp-config.php first and i used the following PHP script to create one but throw an error
wget -q -O - https://www.mydomain.com/httpdocs/wp-cron.php?doing_wp_cron >/dev/null 2>&1

- I read about native WP-CRON is slow and if i can replace it with real task that would decrease server load time, is that statement is true?

- i tried to create a new task from WP-toolkit and worked fine but i used PATH instead of command, so is creating a CRON by using toolkit is the same as creating one using OS?

Thanks in advance
 
i disabled wp cron from wp-config.php first and i used the following PHP script to create one but throw an error
wget -q -O - https://www.mydomain.com/httpdocs/wp-cron.php?doing_wp_cron >/dev/null 2>&1
As wp-cron.php is a PHP script, you could use the "Run a PHP script" option instead from task scheduler. If that does not work for you, you could also "Fetch a URL" and provide the URL only.
- I read about native WP-CRON is slow and if i can replace it with real task that would decrease server load time, is that statement is true?
No. The difference is that wp-cron is only executed when the site has visitors. It is very effective on sites with a low number of visitors. Only on high-load sites executing wp-cron.php directly on a schedule is better.
Some people say wp-cron is slow, because on the first visitor that triggers the execution Wordpress spends a bit more time. But compare this to the other, regular task scheduler solution: There your server is put under load every n minutes without there being any need for the load, because there are no visitors who need updated data.
- i tried to create a new task from WP-toolkit and worked fine but i used PATH instead of command, so is creating a CRON by using toolkit is the same as creating one using OS?
Yes.
 
Back
Top