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:
    app/code/VendorName/ModuleName/etc/crontab.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>
		</job>
	</group>
</config>

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

<?php

namespace VendorName\ModuleName\Cron;

class Cron
{

	public function execute()
	{

		//write your code here

	}
}

sexpoundsofttechsolution

Create cron job in Magento 2