The software utility Cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration—though its general-purpose nature makes it useful for things like connecting to the Internet and downloading email at regular intervals.
Cron is driven by a crontab (cron table) file, a configuration file that specifies shell commands to run periodically on a given schedule. The crontab files are stored where the lists of jobs and other instructions to the cron daemon are kept. 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.
Daily crontab system administration tasks might include the following:
The cron.deny and cron.allow files consist of a list of user names, one user name per line.
These access control files work together as follows:
Note:
Cron is driven by a crontab (cron table) file, a configuration file that specifies shell commands to run periodically on a given schedule. The crontab files are stored where the lists of jobs and other instructions to the cron daemon are kept. 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.
For Scheduling Repetitive Jobs: crontab
You can schedule routine system administration tasks to execute daily, weekly, or monthly by using the crontab command.Daily crontab system administration tasks might include the following:
- Removing files more than a few days old from temporary directories
- Executing accounting summary commands
- Taking snapshots of the system by using the df and ps commands
- Performing daily security monitoring
- Running system backups
- Rebuilding the catman database for use by the man -k command
- Running the fsck -n command to list any disk problems
- Listing files not used during a specific month
- Producing monthly accounting reports
Controlling Access to the crontab Command
You can control access to the crontab command by using two files in the /etc/cron.d directory: cron.deny and cron.allow. These files permit only specified users to perform crontab command tasks such as creating, editing, displaying, or removing their own crontab files.The cron.deny and cron.allow files consist of a list of user names, one user name per line.
These access control files work together as follows:
- If cron.allow exists, only the users who are listed in this file can create, edit, display, or remove crontab files.
- If cron.allow does not exist, all users can submit crontab files, except for users who are listed in cron.deny.
- If neither cron.allow nor cron.deny exists, superuser privileges are required to run the crontab command.
Note:
- Check for the job errors in /var/spool/mail/username file.
- Escape percent (%) sign with backslash in command line while scheduling a job.
No comments:
Post a Comment