My objective is to execute a custom class/method (e.g. send data to a backend system) every X minutes. Seems cron is the way to go. Though, I'm new to cron in Magento 2.
What I see so far is I should create a etc\crontab.xml file
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="mymodule_orders_job" instance="My\Module\Model\Observer" >
<schedule>*/5 * * * *</schedule>
</job>
</group>
</config>
and "Observer" does the work. Seems simple enough.
What I'm confused on is, how does this get into cron (crontab)? Also, I see there's a cron_schedule table...not sure what that's used for.
Finally, I want the flexibility to 1) enabled/disabled the job in a custom Admin config and 2) set the interval on the same custom Admin.
I suspect for the custom Admin it would create the etc\crontab.xml and set parms accordingly? Also, since this is a packaged module need the module to be able set things up inclusively
echo "* * * * * php ${project_root}/bin/magento cron:run &" | crontab -u www-data -
and for my module add etc\crontab.xml. As you suggest I'll create another question for my other questions