How to set cron job in AWS

How to set cron job in AWS | hostingride

First of all login AWS ec2-instance through putty or CLI.

We need to do some entry to set a cron job.
 
# Example
 |-------------- minute (0 - 59)
 | | -------------- hour (0 - 23)
 | | |------------------- day of month (1 - 31)
 | | |  |  ------------------month (1 - 12) OR jan,feb,mar,apr ...
 | | |  |  | -------------------- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat

 *  *  *  *  *        user-name     command to be executed

 

file of the configurationThen we need to open .  

# vim /etc/crontabcronjob

conjob in aws linux

add your cron that you want to run

*  *  *  *  *     php    /var/www/html/test.php

config file looks like that (below image)

cronjob configure centos

then save config file type Esc  :wq!   then enter

Then restart crond service

# service crond restart
- To view root’s Cron Jobs use the command
# crontab -l
- To view a user’s Cron Jobs use the command
# crontab -u username -l

Thanks for visit !

also visit AWS INTERVIEW QUESTION AND ANSWERS

Blog type: 

Add new comment

Authored By

Sandeep Gurjar

Hy all, This is Sandeep Gurjar am the founder of hostingride.in. I am a Redhat Certified Engineer (RHCE) / AWS Solutions Architect-Associate and working as an system administrator since 2016.

Follow us on

Facebook​  Twitter  LinkedIn  Google+