Crontab

Crontab

  • Submitted By: keyboard
  • Date Submitted: 12/08/2009 7:03 AM
  • Category: Technology
  • Words: 412
  • Page: 2
  • Views: 286

Crontab - Quick reference
Setting up cronjobs in Unix and Solaris
Cron is a unix, solaris utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These tasks are often termed as cron jobs in unix , solaris.
Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at specified times.
Crontab Restictions
You can execute crontab if your name appears in the file /usr/lib/cron/cron.allow. If that file does not exist, you can use
crontab if your name does not appear in the file /usr/lib/cron/cron.deny.
If only cron.deny exists and is empty, all users can use crontab. If neither file exists, only the root user can use crontab. The allow/deny files consist of one user name per line.

Crontab Commands
export EDITOR=vi ;to specify a editor to open crontab file.

crontab -e     Edit your crontab file, or create one if it doesn't already exist.
crontab -l      Display your crontab file.
crontab -r      Remove your crontab file.
crontab -v      Display the last time you edited your crontab file. (This option is only available on a few systems.)

The most secured way to schedule the cronjobs is listed below
Please follow the below listed steps
1. crontab –l > cron.lst
2. crontab –l > cron.backup.lst
3. vi cron.lst – add the jobs save and quit(:wq)
4. crontab < cron.lst
5. crontab –l – to view the jobs that are scheduled.
 For servers like ARS and SUGS
To list the jobs scheduled – fcront –l
To edit the crontab --- fcront –e

Crontab File
Crontab syntax :-
A crontab file has five fields for specifying day , date and time  followed by the command to be run at that interval.
|*     *   *   *    *  command to be executed |
|-     -    -    -    - |
||     |     |     |     |...