backup using cron ?

hi,

 i would like to backup some file everyweek using cron

0 0 * * 0 tar -cvf abc.tar abc;gzip abc.zip

i would not replace the abc.zip,

thats mean the backup will become
abc.1    week 1
abc.2    week 2
abc.3    week 3
so on.....


Thanx

bsherAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

j2Commented:
0 0 * * 0 tar -czvf abc`date +%V`.tgz abc

will do it all for you you will then get a abcWEEKNUMBEROFYEAR.tgz note that those are BACKTIPS, not single quotes, not aphostrophes.

('man date' is pretty good reference)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
barreroCommented:
the previous proposal is good enough for a permanent backup... byt if you want something like logrotate (ie. just three or four historical backups...)
it's easier to run a script from the crontable.

  The script should look like this one:

mv bck2.tgz bck3.tgz
mv bck1.tgz bck2.tgz
tar -cvzf bck1.tgz <bckfiles>


just add to the script, some controls to avoid error messages the first time when moving unexistent files, or send them to /dev/null

Marcel
0
bsherAuthor Commented:
is it the only way, any better idea?
0
j2Commented:
better idea for what? You got an answer for your original question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.