Tuesday, March 31, 2015

scheduling jobs in linux (cron and at)


To run some programs automatically at a specified time in the future will use scheduling tasks in Linux.

  • Taking backups in middle of night.
  • Installing the packages, updates the patches, etc.

There are 2 tools available in Linux: AT Jobs & CRON Jobs

AT: It allows performing particular job at particular time, but not repentantly.
To Run the At jobs To Monitoring the At jobs :

#at 17:30 atq

#at 12:00 tomorrow at -l
#at 5pm + 1 day / tomorrow at –c <Job No>
#at 11am jul 31 atrm <Job No>


CRONTAB :It allows performing the schedule tasks repentantly in future., So we can schedule Jobs “Minute, Hours, Day, Month and Year wise.

To Run the Cron Jobs: crontab –e

To List the Cron Jobs: crontab –l

To Run the Cron Jobs with specific User: contab –u <username>

Syntax of Crontab :

Minutes    Hours      Date of Month   Month of Year         Day of Week
0 to 59    0 to 23   1 to 31               1 to 12                      0 to 6


Ever Two Minutes Particular Hour Particular day of month Particular Month of year
*/2 12 11 08 <JOB>
Random Minutes Random Hours Random days of month Random Months
1,30,45 08,10,22 1,15,30 01,10,12 <JOB>




No comments:

Post a Comment