What is Linux cron job ?



Cron is the time-based job scheduler in Unix-like computer operating systems. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration.

Linux Cron utility is an effective way to schedule a routine background job at a specific time and/or day on an on-going basis.


crontab

The command to create/edit, list, and remove cron jobs is crontab. If you call it with the -u option, it specifies the name of the user whose crontab is to be tweaked. If this option is not given, crontab examines crontab

Examples:
crontab -l
lists the cron jobs of the user as that you are currently logged in:
lists all cron jobs of exampleuser.
crontab -e
let's you create/modify the cron jobs of the user as that you are currently logged in (I'll come to the syntax in the next chapter).
crontab -u OSuser -e
let's you create/modify the cron jobs of OSuser
crontab -r
deletes all cron jobs of the user as that you're currently logged in.
crontab -u OSuser -r
deletes all cron jobs of OSuser


A cron job consists out of six fields:
<minute> <hour> <day of month> <month> <day of week> <command>

Linux Crontab Format
MIN HOUR DOM MON DOW CMD

*    *    *    *    *  command to be executed
┬    ┬    ┬    ┬    ┬
│    │    │    │    │
│    │    │    │    │
│    │    │    │    └───── day of week (0 - 7) (0 or 7 are Sunday, or use names)
│    │    │    └────────── month (1 - 12)
│    │    └─────────────── day of month (1 - 31)
│    └──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)


Share your views...

0 Respones to "What is Linux cron job ?"

Post a Comment

 

© 2010 Codes & Concepts All Rights Reserved Thesis WordPress Theme Converted into Blogger Template by Hack Tutors.info