Wiki: https://en.wikipedia.org/wiki/Cron
Use of Cron in UltimatePOS
Cron Jobs are used for the following purposes:
Setting up a cron job
Cron Jobs are used for the following purposes:
- 1. You will find cron job command in Administrator Backup screen(available since V2.13)
- or WooCommerce module API settings or Superadmin Cron Jobs Menu.
- It will be in this format:
- * * * * * php /path_to_pos_folder schedule:run >> /dev/null 2>&1
- 2. Login into your Cpanel or direct admin or similar server management portal and Go into Cron Jobs or scheduler menu.
- 3. In the “Add New Cron Job” section, select:
- minutes = *
- Hour = *
- Day = *
- Month = *
- Weekday = *
- Command = php /path_to_pos_folder schedule:run >> /dev/null 2>&1
The command is same as the command displayed above except removing all the * before it.
- 4. Click “Add New Cron Job” Button and it will be added.
- NOTE: only one cron job is required for all features, don’t add it multiple times.
- NOTE: The cron command will be found in Superadmin settings, Woocommerce settings and Administer Backup page.
Setting cronjob interval in the code:
Follow the file path in the codebase
pos\Modules\Woocommerce\Providers\WoocommerceServiceProvider.php
Search for the line twiceDaily(1, 13) and change it as per required.
Refer to the laravel official document below.
https://laravel.com/docs/9.x/scheduling#schedule-frequency-options
If you’re not using woocommerce module, follow this path pos\app\Console\Kernel.php.
Cron job errors & Fixes:
ArgvInput.php ‘Invalid argument supplied for foreach()’
To fix this error, go to edit php.ini and enable/turn-on register_argc_argv ini settings. And it will start to work fine.