I Love Tips

Nice Tips & Tricks made easy

Crontab Usage

Posted by Rajkiran Ghanta on December 23, 2007

crontab utility helps to set up tasks to run automatically in the background at regular intervals, as specified in the schedule.
You can use cron.allow and cron.deny files under /usr/lib/cron directory to control access to the cron.
crontab -e Edit crontab file, or create one if it doesn’t already exist.
crontab -l Display crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time the crontab file is edited

The following is the crontab file syntax
* * * * * command
- – - – -

+—– day of week (0 – 6) (Sunday=0)
+——- month (1 – 12)
+——— day of month (1 – 31)
+———– hour (0 – 23)
+————- min (0 – 59)

Example

Crontab entry for health check report that runs every night at 11.30pm

30 23 * * * /home/oracle/monitoring/health.sh > /logs/health.log 2>&1

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>