LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 08-17-2011, 10:39 AM   #1
Spyder512
LQ Newbie
 
Registered: Aug 2011
Posts: 1

Rep: Reputation: Disabled
Creating a Cron File


Hey everyone, I was hoping someone can help me create a Cron file. I've tried reading through my Linux book but I am just lost here. I need to create a Cron file that will perform a Level 0 backup once per month, a Level 2 dump one day per week, and a Level 5 dump every day that neither a level 0 nor a level 2 dump is performed. Thanks for any help, it is greatly appreciated.
 
Old 08-17-2011, 11:46 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,956

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by Spyder512 View Post
Hey everyone, I was hoping someone can help me create a Cron file. I've tried reading through my Linux book but I am just lost here. I need to create a Cron file that will perform a Level 0 backup once per month, a Level 2 dump one day per week, and a Level 5 dump every day that neither a level 0 nor a level 2 dump is performed. Thanks for any help, it is greatly appreciated.
Well, no idea what you mean by a "level 2" dump, or any of the other "level" backups. Also, you don't say what version/distro of Linux you're using, or what program(s) you're taking these backups with. Hard to give help without details.

Read the man pages on crontab, and Google has lots of different reference guides that do a great job explaining cron, like this one:
http://www.thegeekstuff.com/2009/06/...ntab-examples/

So, whatever program you're using to do your backups, write a shell script (if needed), that does what you want for each 'level'. Then schedule them with cron. Your details are vague...you say "once per month", "one day per week". When is "once a month"?? First of the month? 10th? 21st? Same for one day per week...scheduling details are going to be different for all of that criteria. And your 'level 5' dump can just be scheduled for all the other days of the week.
 
Old 08-17-2011, 11:52 AM   #3
thesnow
Member
 
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 170

Rep: Reputation: 56
I like this page for cron reference http://en.wikipedia.org/wiki/Cron as it gives a lot of specific examples.

For your question, should the Level 2 only be performed on days there was not a Level 0? And does it matter if the Level 2's are not exactly one week apart (e.g., must they always be run on Sundays)?

In either case, you could maybe do something like:
1. Run the level 0 on the first Sunday of every month
2. Run the level 2 on every Sunday (or Sundays 2-5 of every month if they're not supposed to run on the same day)
3. Run the level 5 M-Sat
 
Old 08-17-2011, 12:00 PM   #4
Annielover
Member
 
Registered: May 2011
Location: Belgium
Distribution: Ubuntu Server Edition, Fedora 16
Posts: 90

Rep: Reputation: 8
Hi,

First of all: you already have a cron file, it's builtin in Linux when you install it... The file is just empty.
To open the cron file, and execute a command as root, type
Code:
sudo crontab -e
To make a level 0 backup every month, you could type
Code:
0 0 1 * * dump -0u -f  [destination path] [directory to backup]
The above example will run the dump command the first day of every month at midnight.
And for the level 2 dump once a week
Code:
0 0 * * 0 dump -2u -f  [destination path] [directory to backup]
 
Old 08-17-2011, 12:08 PM   #5
Annielover
Member
 
Registered: May 2011
Location: Belgium
Distribution: Ubuntu Server Edition, Fedora 16
Posts: 90

Rep: Reputation: 8
Quote:
Originally Posted by TB0ne View Post
Well, no idea what you mean by a "level 2" dump, or any of the other "level" backups. Also, you don't say what version/distro of Linux you're using, or what program(s) you're taking these backups with. Hard to give help without details.
TB0ne, what Spyder means with a "level 2" dump: those levels apply to incremental backups and the levels range from 0 to 9, where level number 0 means a full backup and guarantees the entire file system is copied. A level number above 0, incremental backup, tells dump to copy all files new or modified since the last dump of the same or lower level. To be more precise, at each incremental backup level you back up everything that has changed since the previous backup at the same or a previous level.

And Linux has a command named dumb.

---------- Post added 08-17-11 at 06:09 PM ----------

Quote:
Originally Posted by TB0ne View Post
Also, you don't say what version/distro of Linux you're using.
With distro do you use, Spyder?
 
  


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
Creating a cron job to email me a txt file/format? NewShockerGuy Linux - General 7 05-16-2008 10:23 AM
cron file 000-delay.cron (it is on my FC5) - what is the purpose? jtmoon Linux - Server 1 03-08-2007 12:15 PM
Creating Cron Jobs simba_cubs Linux - General 1 09-27-2006 06:42 PM
Cron - not creating log file t3___ Linux - Newbie 3 02-26-2004 07:50 PM


All times are GMT -5. The time now is 01:33 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