Windows Cronjobs is a tool designed to bring the functionality of cPanel cron jobs to Windows so that cron jobs can be tested locally.
Official GitHub Link: https://github.com/putuardiworks/windows-cronjobs
for Indonesians: README ini juga tersedia dalam Bahasa Indonesia.
When developing a PHP project that requires cron jobs, I usually test them directly in cPanel. This process feels somewhat cumbersome and inefficient for local development, especially if you don't have cPanel hosting. Additionally, it can be difficult to know which scripts have been set as cron jobs and what their configurations are in cPanel.
Windows Cronjobs was developed to address these issues. By providing functionality similar to cPanel cron jobs, this tool allows us to test cron jobs locally on Windows and ensure that cron jobs configurations are well-documented within the code.
-
Download and Extract:
- Download the repository as a
.zip
file. - Extract the contents.
- Download the repository as a
-
Copy Configuration File:
- Make a copy of
windows-cronjobs.config.example
. - Rename the copied file to
windows-cronjobs.config
.
- Make a copy of
-
Configuration:
- Open
windows-cronjobs.config
. - Set
php_path
to the location of yourphp.exe
. (required) - Set the
timezone
. (optional)
- Open
-
Add Cron Jobs:
- Edit
cronjobs_list.php
. - Add your cron jobs as shown in the example.
- Edit
-
Start Cron Jobs:
- Double-click
windows-cronjobs.bat
to start the cron jobs.
- Double-click
-
Stop Cron Jobs:
- Press
Ctrl+C
in the PowerShell window that was opened when starting the cron jobs.
- Press
Windows Cronjobs v0.2.2 currently only supports common cron jobs settings found in cPanel:
- Once Per Minute:
* * * * *
- Once Per Five Minutes:
*/5 * * * *
- Twice Per Hour:
0,30 * * * *
- Once Per Hour:
0 * * * *
- Twice Per Day:
0 0,12 * * *
- Once Per Day:
0 0 * * *
- Once Per Week:
0 0 * * 0
- On the 1st and 15th of the Month:
0 0 1,15 * *
- Once Per Month:
0 0 1 * *
- Once Per Year:
0 0 1 1 *
Planned enhancements for future versions:
- Support for specific time values.
- Support for time ranges.
- Support for lists of values.
- Support for intervals.
This project is licensed under the MIT License. See the LICENSE
file for more details.