[clug] roll config/log files over and write new in one go

Paul Wayper paulway at mabula.net
Mon Nov 26 10:53:17 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I wrote a little utility to solve a problem I have occasionally when updating
things like my iptables config.  Normally I save my old config in a unique
file name by date, and then write the new one, but that's two commands (more
if I have to try and work out whether I've written one today or not).
iptables-save writes directly to stdout so I wanted a pipe command, and the
utility I wrote allows you to do things like this:

iptables-save | roll /etc/sysconfig/iptables

This will shuffle the iptables config down to iptables.yyyymmdd, that one down
to iptables.yyyymmdd.1, and so forth until it hasn't done a rename yet.  Then
it takes the pipe from stdin and writes it into the named config file, all in
one go.  If, on the other hand, you want to have the newest file put at the
end of the list instead of the first, you can do:

iptables-save | roll -m /etc/sysconfig/iptables

And it will move the old config file to the last position instead of the
first.  There are a few other options at this stage but I have a few plans for
it in the future.

I'm inviting you to download it either directly from
http://mabula.net/code/roll.c or by checking out
svn://tangram.dnsalias.net/roll/trunk in Subversion.  Compile it, use it, see
what it does, and let me know what you think.  I'm interested in all feedback
- - like it, hate it, think it could do better, let me know!  Of course, you can
also contribute to it if you like, either by sending me a diff file or a
request for write access to the Subversion repository.  I know all the cool
kids are using distributed RCS these days but I'm still using the old one I
know and trust.

Anyway, let me know what you think!

Have fun,

Paul
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHSqWdu7W0U8VsXYIRAkJBAJ91sXDXbHKTnqASg7R3Cc1wMflIqwCeM1Vc
xFdYOM/nHb8pE+f94glkelM=
=jOGy
-----END PGP SIGNATURE-----


More information about the linux mailing list