Crontab Concepts and details:
Hey BDA-Mates,
As we know that CRON is a Linux program and it is very
helpful and useful for a programmer or DBA.
Crontab allows a task to be run automatically in
background at mentioned date/time.
For example:
We can schedule cron for backups,
schedules update, synchronize files, Getting messages for completion tasks,
getting alerts such as tablespace size details, blocking sessions, temp usage etc.
There are 5 entries in crontab.
For example:
1 2 3 4 5 /bin/ora-data.blogspot.com/scriptname.sh
Here:
1 : Minute (from 0 to 59)
2 : Hour (from 0 to 23)
3 : Date of the month ( from 1 to 31)
4 : Month ( from 1 to 12)
5 : Day of week (from 0 to 7, here 0 and 7
are Sunday)
If we want to check which crontabs are currently
running on our server? We have to login to our server and run the below
command:
$hostname;id
ora-data.blogspot;ora-data
$crontab -l
1 2 3 4 5
/bin/ora-data.blogspot.com/scriptname.sh
If you want to make changes or edit in crontab, follow
below command:
$crontab -e
1 2 3 4 5
/bin/ora-data.blogspot.com/scriptname.sh
From above command, we will get all the crontab entries
in which we have to find out the script name and edit or change the date and
time as per your requirements, Save and then exit.
Note: Always be careful during edit the crontab on PROD.
Please find the below examples for references:
1. Suppose we want to execute any scripts every minute
then we can use below commands:
* * * * *
/bin/ora-data.blogspot.com/scriptname.sh
Here, * asterisk or start means every. So, this above
command will run for every minute, every hour, and every date of month, every
month and every day of week.
2. Example for execute on Friday at 7 AM, each date and
every month.
0 7 * * 5
/bin/ora-data.blogspot.com/ora-data.sh
3. Suppose, we want to execute our scripts only on
Friday and Saturday at 5 AM.
0 5 * * 5-6
/bin/ora-data.blogspot.com/ora-data.sh
4. Suppose, we want to execute at every 10 min.
0,10,20,30,40,50 * * * *
/bin/ora-data.blogspot.com/ora-data.sh
5. Suppose, we want to check a particular running
crontab.
$crontab -l |grep crontabname
Some more useful links:
Hope this will be useful and helpful. For any
suggestion please write to us either in comment box or @Contact us: https://ora-data.blogspot.in/
Regards,
ora-data Team
ora-data Team
I have been surfing online more than three hours lately,
ReplyDeletebut I by no means discovered any interesting article like yours.
It's beautiful worth sufficient for me. Personally, if all
website owners and bloggers made good content as you did, the net will probably be a
lot more helpful than ever before.
Website: http://herb24.space
I believe everything published made a ton of sense.
ReplyDeleteHowever, what about this? suppose you wrote a catchier title?
I mean, I don't wish to tell you how to run your blog, however suppose you added a
title that makes people want more? I mean "Crontab Concepts and details with examples" is a little plain.
You might look at Yahoo's home page and see how
they create article headlines to grab viewers to click.
You might try adding a video or a pic or two to get people
excited about what you've got to say. Just my opinion, it could make your website a little bit more interesting.
Website: http://herb24.space
Its like you learn my mind! You appear to grasp so much approximately this,
ReplyDeletelike you wrote the e book in it or something.
I think that you just could do with a few % to force the message
home a bit, but instead of that, that is great blog.
A fantastic read. I will certainly be back.
cron job
ReplyDeleteA cron job is a Linux command used for scheduling tasks to be executed sometime in the future. This is normally used to schedule a job that is executed periodically – for example, to send out a notice every morning. Some scripts, such as Drupal and WHMCS may require you to set up cron jobs to perform certain functions.Your Blog is amazing. If you want to know that HOW TO SETUP A CRON JOB then,
ReplyDeleteClick here for more information:
HOW TO SETUP A CRON JOB