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?
 
j2Connect With a Mentor Commented:
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
 
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
All Courses

From novice to tech pro — start learning today.