How to setup Magento 2 cron in cPanel?

Hi, we are on shared hosting using cpanel running magento 2.1 on php7. We are getting an error “One or more indexers are invalid. Make sure your Magento cron job is running.”. Can we run the same commands above from cpanel? Please help.

1: Go in cpanel and find the magento 2 directory path

2: Go to cronjobs.

3: Add the cron job

/usr/bin/php -q /pathto/public_html/Magento2/Crondirectory/sample-mail.php

You can test the cronjob by placing the mail code

Test mail:
$message = “”;
$from = "test@gmail.com";
$to = "your@gmail.com";
$subject = “PHP Mail Test script”;
$message.= “test email”;
$headers = “From:” . $from;
mail($to,$subject,$message, $headers);

Also please restart the apache also if not getting any results.