LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Creating a Cron File (https://www.linuxquestions.org/questions/linux-newbie-8/creating-a-cron-file-897846/)

Spyder512 08-17-2011 09:39 AM

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.

TB0ne 08-17-2011 10:46 AM

Quote:

Originally Posted by Spyder512 (Post 4445584)
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.

thesnow 08-17-2011 10:52 AM

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

Annielover 08-17-2011 11:00 AM

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]

Annielover 08-17-2011 11:08 AM

Quote:

Originally Posted by TB0ne (Post 4445667)
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 (Post 4445667)
Also, you don't say what version/distro of Linux you're using.

With distro do you use, Spyder?


All times are GMT -5. The time now is 06:18 PM.