cp foo foo.20091202(the extension is year - month - day)
This proved to be a poor way to backup files and it has a lot of drawbacks. Now, I usually use RCS to do this job. It gives you most of the advantages of a revision control system like CVS or subversion but without the burden to install lot of binaries, libraries and create global repositories (of course, with rcs you don't have the concurrent access feature nor authentication stuff but we don't really care about that just to backup some configuration files).
In Debian, you can install it like this :
apt-get install rcsIf you have Redhat, it would be :
yum install rcs
Then, to backup a file in the current directory :
mkdir RCS("-l" option is for the lock feature of rcs, something that does not seem very usefull to my view).
ci -l foo
After some changes in the file, you can see them with rcsdiff :
rcsdiff fooTo save a new version of the file :
ci -l fooIf you want to list all the versions of your file :
rlog fooTo check the differences between version 3 and version 5 :
rcsdiff -r3 -r5 fooAnd finally, if you want to get version 4 back :
co -r4 foo
One thing I do appreciate by using rcs to modify every configuration file, is that it is very easy to know all the changes you've made on your server (for instance, if you have to migrate the server to a new OS it may be helpfull) by typing :
locate RCS
Of course, this will never sustitute a real remote backup policy (with TSM or Netbackup for instance) of your server. But it is much more flexible to know what was changed in a file with RCS than looking your modified versions on the tapes...
Keep in mind that RCS is for local changes. If you want to do the same modification on a file on all your servers, maybe you should pass to a CVS/subversion system, or use a different method to centralize your changes.
No comments:
Post a Comment