What is a cron job ?
Cron Job is a linux server feature which is used to schedule a task to run automatically at a certain time and date.
How to use cron job ?
Following the below given steps , we can use it.
Step 1 : Login your cpanel account with your username and password.
Step 2: Go to advance section and find cron jobs option in this section, click on it.
Step 3: Here you can see the following options.
- Common setting select box : here select an option as per your choice. I choose Once Per Minute(* * * * *)
- Minute : Specify here after the how many minutes , you want to execute your cron command.
- Hour: Numbers of hour to execute cron command.
- Day: If you want to execute your command after few days, specify the number of the days here.
- Month: If you want to execute your command after few months, specify the number of months here
- Weakday: To run job at a specific weak day, specify that day.
- Command: Here write cron command as given below.
/usr/local/bin/php -q /home/[cpanel username]/public_html/[file name]
Example: /usr/local/bin/php -q /home/fz6u5qloh872/public_html/email.php
<?php mail("email@example.com","firstname.lastname@example.org", "cron job", "cron job message"); ?>
After one minute scheduled job execute automatically and you will receive an email from server.
If You feel any difficulty , you can leave it on comment.I will surely answer you.