2

Here's what I'm trying to do:

  1. modify a default configuration file on a local machine (Thing.conf).
  2. save the previous config file on a virtual client to something like Thing.conf.1, and keep track of the previous 10 or so conf files. (Thing.conf.2, Thing.conf.3, etc.)
  3. push that configuration file to the remote virtual client (/etc/thing/Thing.conf).

to be clear -- step 2 is the crux of the problem here, step 1 and 3 are just for context.

Cameron Sparr
  • 3,925
  • 2
  • 22
  • 31
  • 2
    can you just put your file under version control? http://mercurial.selenic.com/ – dm03514 Nov 15 '12 at 20:44
  • 2
    Is this question related to `python` ? – Julien Vivenot Nov 15 '12 at 20:46
  • If this a generic problem, i.e. not for an application coded in Python, then you're probably better off just using [logrotate](http://linux.die.net/man/8/logrotate). If it is for an application coded in Python then @MattiLyra's answer is the way to go. – Pedro Romano Nov 15 '12 at 20:52
  • @dm03514 it's not possible for us as then it would involve a commit and push every time the code is run, which would be sub-optimal for a number of reasons in our framework – Cameron Sparr Nov 15 '12 at 21:30
  • @jvivenot yes I am looking for a python tool that does this (see title) – Cameron Sparr Nov 15 '12 at 21:31

1 Answers1

3

The python logging framework has a RotatingFileHandler, it also allows you force a rollover with RotatingFileHandler.doRollover(). I'm not sure if that's what you're after though. It'll allow you to roll over the log (config?) files on the virtual client where the logging is presumably being done.

Pedro Romano
  • 10,973
  • 4
  • 46
  • 50
Matti Lyra
  • 12,828
  • 8
  • 49
  • 67