Linux Job Scheduler - CRON

Who doesn't like the free job scheduler that comes with Linux Operating System? I find CRON very powerful and I use it daily on my personal and professional projects. More and more companies these days are adopting enterprise level scheduler tool like control-M. These enterprise has it own advantages as they are server independent and can be managed easily from a centralized location. Cron are hard to manage as they are server dependent and may cause a problem if the server where the cron sits is down. Beside one disadvantage, I find it very powerful tool which makes my life easy as I automate most of my task at home and work both.
Let's learn to set up Cron and make everyone's life easy.

crontab -- help
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [-u user] [ -e | -l | -r ]
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)
        -s      (selinux context)

cat /etc/crontab

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  *  command to be executed

#Runs every 15 min.
 */15 * * * * /home/dbarepublic/scripts/backup_dbarepublic.ksh
#Runs every Hour

0 */1 * * * /home/dbarepublic/scripts/check_uptime.ksh

It is easy as a b c d e to set up jobs in cron. I love it so much that it helps me automate my task to run scripts, set up alerts and notifications. If cron wasn't here, I wont have time to write these articles.

Interested in working with me? I can be reached at pbaniya04[at] for any questions, consulting opportunities or you may drop a line to say HELLO. Thank your again for visiting my blog and looking forward to serving you more.

Have a Database-ious Day!

No comments

Powered by Blogger.