LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-10-2012, 05:32 PM   #1
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,104

Rep: Reputation: 181Reputation: 181
Question crontab schedule


hi gurus, if i want to do a back up on hourly basis. so i will do it on: /etc/cron.hourly then i will do a crontab -e on this folder?

How do i do it? please help. Thanks.
 
Old 04-10-2012, 05:39 PM   #2
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
After executing crontab -e you can give this line for an example:

Quote:
0 * * * * <backup_command_or_script>
 
Old 04-10-2012, 05:56 PM   #3
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Code:
#  .---------------- minute (0 - 59)
#  |   .------------- hour (0 - 23)
#  |   |   .---------- day of month (1 - 31)
#  |   |   |   .------- month (1 - 12) OR jan,feb,mar,apr ...
#  |   |   |   |  .----- day of week (0 - 7) (Sunday=0 or 7)  OR sun,mon,tue,wed,thu,fri,sat
#  |   |   |   |  |
#  *   *   *   *  *  command to be executed
#
   *   */1 *   *  *  /path/to/backup/script.sh
I always include the headers in my crontabs for reference. The /1 is the way I always do it and is what I was taught is the "proper" way to do it. However, the above post from Satyaveer Arya will work as well and will trigger the cron every time the minute is at 0.


You can also create your backup script in /etc/cron.hourly/ and name it 0backup and it will run every hour as well.
 
Old 04-11-2012, 05:11 AM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,104

Original Poster
Rep: Reputation: 181Reputation: 181
Thank you guys for your great help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to run a crontab schedule hourly jsaravana87 Linux - Server 5 12-01-2011 12:26 PM
Using crontab to schedule a script stuball Linux - Server 9 05-19-2009 08:39 AM
schedule a crontab rupesh_pulikool Solaris / OpenSolaris 7 09-04-2004 10:32 PM
crontab schedule help onlykims Linux - Newbie 2 08-28-2004 01:09 PM
Schedule TOP command in Crontab. imsajjadali Red Hat 2 05-20-2004 05:12 AM


All times are GMT -5. The time now is 08:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration