How to write a simple crontab?
- Crontab – Quick & Complete reference Setting up cronjobs in Unix and Linux.
- CentOS Linux install and configure NTP to synchronize the system clock
- Passing arguments given to a command alias Linux / Unix / Bash
- MySQL snippets – CREATE TABLE statement sample as bash shell.
- Oracle Applications: Submitting Concurrent Request Using FND_CONCURRENT.WAIT_FOR_REQUEST Sample Code
Crontab (normally they call cron job) are scheduler for an user.
Using this, you can schedule jobs for specified interval, like minutes, hours, days, weeks, and month.
I do not want to provide details description.
Login to linux, say “crontab -e” (without quotes)
Just cut and paste code here.
You are done. As you guess, one job runs every 15 mins, another 20 mins….
####################################################################
#
#min hour day_of_month month day_of_week user command
*/15 * * * * /root/crons/denyhack > /dev/null 2>&1
*/20 * * * * /root/crons/denyhack2 > /dev/null 2>&1
*/25 * * * * /root/crons/denyhack3 > /dev/null 2>&1
*/35 * * * * /root/crons/denyhack4 > /dev/null 2>&1
####################################################################
So they way cron works is it looks at its config file, the ‘crontab’ and when the conditions are met for an entry, it will run that entry. What this means is that you will have to write a script for cron to call that does everything you want it to do. If you have any experience with perl, it would probably be a good choice here. Otherwise any other programming language will do.
As far as the actual cron job goes:
* * * * * command to be executed
- – – – -
‘ ‘ ‘ ‘ ‘
‘ ‘ ‘ ‘ +—– day of week (0 – 6) (Sunday=0)
‘ ‘ ‘ +——- month (1 – 12)
‘ ‘ +——— day of month (1 – 31)
‘ +———– hour (0 – 23)
+————- min (0 – 59)

Comments
No comments yet.