Create a cron job in Magento 2

For creating the cron job, please follow the below instructions:Create cron job in Magento 2

  1. You have to create the custom module or create the file in existing module
  2. After that, create the crontab.xml in this path:
<?xml version="1.0" ?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
	<group id="default">
		<job instance="VendorName\ModuleName\Cron\Cron" method="execute" name="custom_cron">
			<schedule>* * * * *</schedule>

3. Create the Cron.php in this file path:
File: app/code/VendorName/ModuleName/Cron/Cron.php


namespace VendorName\ModuleName\Cron;

class Cron

	public function execute()

		//write your code here



Create cron job in Magento 2