Articles on: Game Server Tutorials

How to schedule a task

The Schedule timer functions as a basic CRON timer, an essential tool for automating tasks at specific intervals. This guide aims to demystify CRON timings for those new to this concept, providing a clear understanding of how to configure your tasks effectively. The CRON format consists of several fields, each representing a different unit of time.

Here's a breakdown of each field to help you set up your schedule accurately:

Minute: Specifies the minute of the hour the task will run. Valid entries range from 0 to 59. You can use for "every minute," or intervals like /5 for "every 5 minutes."
Hour: Works similarly to the minute field but for hours, accepting values from 0 to 23. denotes "every hour," and /5 would mean "every 5 hours."
Day of Month: Indicates the day of the month the task should execute. You can choose any day from 1 to 31 or use * to run the task daily, regardless of the date.
Day of Week: Determines the day of the week the task is allowed to run. It accepts values from 1 (Monday) to 7 (Sunday). Use * for tasks that can run any day of the week.

To give you a better idea of how to configure your own tasks, here are some examples:

0 0 *: Runs the task daily at midnight.
30 12 *: Executes the task daily at 12:30 PM.
0 0 1: Schedules the task for every Monday at midnight.
0 0 1 : Sets the task to run at midnight on the first of every month.

Please note the timezone of your hardware, as CRON tasks will run based on the hardware's time settings.

Configuring the correct CRON timing is crucial for ensuring your tasks run as intended. A good understanding of the CRON format and thoughtful planning of your tasks' schedule can significantly enhance automation and efficiency. Consider using online resources and tools designed to assist in generating CRON expressions, such as this tool.

Updated on: 06/02/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!