Last updated on July 31st, 2016 at 11:14 am

Cron job is very important part of web application now a days. With help of cron job we can run large process in background without interrupting user.

Defination by Wiki.
The software utility Cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. –

Amazon Web Services

Amazon web services is one of the most popular platform to run large and scalable website. Amazon provide no of services to make your web application load fast etc. Configuring cron job on AWS is little bit confusing for first time and i also did not find any proper documentation to setup cron job over AWS so after google some hour and try no method share by the people i finally setup my cron job and ready to share my knowledge with you in a simple step.

Step 1. Login to you AWS console create instance if you not created yet.

Step 2. Login to your AWS instance through Putty.

Step 3. Type crontab -e.

Step 4. Now editor is open inside your putty you need to add your command inside it

* * * * * php /var/www/html/cron.php

5 star are explain as in table below

FieldRange of values
day-of-week0-7 (where both 0 and 7 mean Sun, 1 = Mon, 2 = Tue, etc)
command-line-to-executethe command to run along with the parameters to that command if any

In command after setting time in min, hour, day, month, day-of-week we set our file path which we need to execute according to time.

To paste this command inside editor press Insert from keyboard and to paste your command inside editor press Shift + Insert

Once command is inserted inside editor press esc and after that type :wq to save and exit from editor.

Step 5. Now check your cron is save successfully or not by typing crontab -l.

Step 6. Change your file mode so it was execute by typing chmod 755 /var/www/html/cron.php.  You also change your file permission from filezilla.


$to = "[email protected]"; 
$fr_email = '[email protected]'; 
$subj = 'Hi this is from AWS Cron';
/* Create a simple msg body */
$body = "Welcome to Aws\n";
$body .= "\n";
// Now send email
mail($to,  $subj, $body, "From: <$fr_email>");

After this check your email.