A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.
#——————————————————————————————
# Minute Hour Month Day Month Weekday Command
# 0-59 0-23 1-31 1-12 0-6 (0=Sunday)
#——————————————————————————————
* * * * * command to be executed
– – – – –
| | | | |
| | | | +—– day of week (1 – 7) (monday = 1)
| | | +——- month (1 – 12)
| | +——— day of month (1 – 31)
| +———– hour (0 – 23)
+————- min (0 – 59)
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.
Example:
To run the calendar command at 6:30 a.m. every Monday, Wednesday, and Friday, enter:
1
|
30 6 * * 1,3,5 /usr/bin/calendar
|
To run the calendar command every day of the year at 6:30, enter the following:
1
|
30 6 * * * /usr/bin/calendar
|
To run a script called maintenance every day at midnight in August, enter the following:
1
|
0 0 * 8 * /u/harry/bin/maintenance
|
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.
Latest posts by Brijesh Gogia (see all)
- Oracle Multitenant DB 4 : Parameters/SGA/PGA management in CDB-PDB - July 18, 2020
- Details of running concurrent requests in Oracle EBS - May 26, 2020
- Oracle Multitenant DB 3 : Data Dictionary Architecture in CDB-PDB - March 20, 2020