Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#44345 closed defect (bug) (fixed)

Error in handbook

Reported by: old_fart's profile Old_fart Owned by:
Milestone: WordPress.org Priority: normal
Severity: normal Version: 4.9.6
Component: Cron API Keywords:
Focuses: docs Cc:

Description

Page: https://developer.wordpress.org/plugins/cron/hooking-into-the-system-task-scheduler/

1.)
Phrase:
"For example if you wanted to run a command every 15 minutes regardless of the hour, day, or month it would look like:

15 * * * * command"

is incorrect. This command will runs once per hour. To run cron every 15 minutes such cron job should be:

*/15 * * * * command

2.)
Offering people to use command in cron:
wget http://YOUR_SITE_URL/wp-cron.php

will flood system log with useless messages.
wget in such use case should run in quiet mode as:

wget -q -O - http://YOUR_SITE_URL/wp-cron.php >/dev/null 2>&1

Change History (2)

#1 @garrett-eclipse
5 years ago

  • Component changed from General to Cron API
  • Focuses docs added
  • Keywords cron removed
  • Milestone Awaiting Review deleted
  • Resolution set to fixed
  • Status changed from new to closed

Hi @Old_fart , Thank you for the report.

Checking on this the page is now moved here - https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/

1 - This seems to be correct now in the current handbook;

If a command should be run regardless of one of the time sections an asterisk (*) should be used. For example if you wanted to run a command every 15 minutes regardless of the hour, day, or month it would look like:
*/15 * * * * command

2 - It appears the documentation on this has also been updated but rather than using -q -O and >/dev/null 2>&1 it recommends using the --delete-after option.

Many servers have wget installed and this is an easy tool to call the WordPress Cron script.
wget --delete-after http://YOUR_SITE_URL/wp-cron.php
Note: without –-delete-after option, wget would save the output of the HTTP GET request.

A daily call to your site’s WordPress Cron that triggers at midnight every night could look similar to:
0 0 * * * wget --delete-after http://YOUR_SITE_URL/wp-cron.php

  • To my understanding they achieve the same goal of avoiding the 'flood [of] system log with useless messages'.

I'm closing as these points appear to have been addressed with the latest handbook documentation. @Old_fart if I've missed the mark please re-open.

Thanks again for pointing this out.

#2 @SergeyBiryukov
4 years ago

  • Milestone set to WordPress.org
Note: See TracTickets for help on using tickets.