
- Unix Commands Reference
- Unix - Tutorial Home
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
cron - Unix, Linux Command
NAME
cron - daemon process to execute scheduled commands.
SYNOPSIS
cron
DESCRIPTION
Cron searches /var/spool/cron for crontab files which are named after accounts in /etc/passwd; crontabs found are loaded into memory. Cron also searches for /etc/crontab and the files in the /etc/cron.d/ directory, which are in a different format. Cron then wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute.
To Modify a cron job
To edit a users crontab entry, log into your system for that particular user and type crontab -e. It will open up using its default editor vi. cron checks each minute to see if its spool directory's modtime (or the modtime on /etc/crontab) has changed, and if it has, cron will then examine the modtime on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab file is modfied. Note that the crontab command updates the modtime of the spool directory whenever it changes a crontab.
Mailing output
Cron will email to the user all output of the commands it runs, to silence this, redirect the output to a log file or to /dev/null. You can also redirect email to the user named in the MAILTO environment variable in the crontab, if any exists.
EXAMPLES
Go to /etc/rc and run cron
$ cd /etc/rc $ cronPrint