Categories
technews

What’s a cron and crontab?

Cron is a a time-based job scheduler in Unix/Linux environments. Cron can be used to schedule jobs to run periodically at fixed times, dates or intervals.  Crontab is a configuration file that specifies  shell  commands to run periodically on a given schedule.

Users can have their own individual crontab files and often there is a system wide crontab file (usually in /etc or a subdirectory of /etc) that only system administrators can edit.

Crontab format

MIN  HOUR DOM MON DOW <command to execute>

  1. MIN =Minute(0-59)
  2. HOUR =HOUR(0-23)
  3. DOM =Day Of Month(1-31)
  4. MON =Month(1-12)
  5. DOW =Day Of Week(0-6)

cron

How to view crontab entries?

To view current user’s crontab, use “crontab -l

eg :

cron1

 

 

To view other user’s crontab, login as root and give “crontab -u sam -l

cron2

 

 

How do I edit crontab entries?

We can issue “crontab -e”  for adding or editing crontab entries.

 

One reply on “What’s a cron and crontab?”

Good one.. I wish if u can write 1-2 guest posts for our blog too. Please message me if you can write. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *