Podcast
Questions and Answers
What should you do before uninstalling the Commerce application?
What should you do before uninstalling the Commerce application?
Where can you find the cron information by default?
Where can you find the cron information by default?
What is the purpose of the --group option?
What is the purpose of the --group option?
Where are exceptions from cron jobs logged?
Where are exceptions from cron jobs logged?
Signup and view all the answers
What is the command to run the indexing cron job?
What is the command to run the indexing cron job?
Signup and view all the answers
What is a cron group?
What is a cron group?
Signup and view all the answers
What is the purpose of creating a crontab.xml file?
What is the purpose of creating a crontab.xml file?
Signup and view all the answers
Why is creating a cron group optional?
Why is creating a cron group optional?
Signup and view all the answers
What is the default cron group used by most Commerce modules?
What is the default cron group used by most Commerce modules?
Signup and view all the answers
What is the purpose of a crontab?
What is the purpose of a crontab?
Signup and view all the answers
Study Notes
Configuring Cron Jobs in Commerce
- Commerce features require at least one cron job to schedule activities in the future.
- Cron jobs are scheduled using a crontab, a file that contains instructions for the cron daemon to run specific commands at set times and dates.
Understanding Crontab
- Each user has their own crontab, and commands are executed as the user who owns it.
- The crontab is the configuration used to run cron jobs.
- Commerce uses cron tasks that can run with different configurations.
Creating and Removing Commerce Crontab
- Starting with version 2.2, Commerce creates a crontab for you.
- The Commerce crontab is added to any configured crontab for the Commerce file system owner.
- To create the Commerce crontab, use the
--force
option to rewrite an existing crontab. - To remove the Commerce crontab, do so only before uninstalling the Commerce application.
Running Cron Jobs
- Run cron jobs from the command line using the
cron
command. - Command options include
--group
to specify the cron group to run. - To run the indexing cron job, use the
cron:run --group=index
command. - To run the default cron job, use the
cron:run
command.
Logging Cron Job Information
- Cron job information has moved from
system.log
to a separatecron.log
. - The cron information can be found at
/var/log/cron.log
. - All exceptions from cron jobs are logged by
\Magento\Cron\Observer\ProcessCronQueueObserver::execute
.
Customizing Crontabs and Cron Groups
- Custom modules can set up crontabs and optionally cron groups for scheduling tasks.
- A crontab is a cron job configuration, and a cron group is a logical group that enables running cron jobs independently.
- To configure a cron group, create a
crontab.xml
file in your module directory.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Learn how to configure cron jobs, which schedule tasks to be performed in the future. Understand how UNIX systems use crontabs to execute commands as a particular user. Test your knowledge of cron job configuration and its applications.