Wednesday, February 24, 2010

Love the New System Admin w/Perl book (and RCS)!

I've been doing a bit of Perl-LDAP programming and I had always found the 2000 version of Perl for System Administration to be really helpful - especially the tutorials in the appendix (more on that in a bit). I just got the the new version: Automating System Administration with Perl. I was amazed at how much more useful it was. Not only is there 50% more material, ALL of the older stuff has been reworked and freshened. The LDAP section I was using heavily is MUCH improved. Too much goodness to cover now - check it out yourself!

The reason I decided to make the post was to mention RCS, in the books appendix, the author has a 5 Minute RCS Tutorial which makes a strong case for using RCS instead of all of those other revision control systems. I've tried RSC in the past and I've tried CVS and the guys in the office recently tried to get me to use Mercurial (Wow! Talk about overkill for what I do!!) But the authors argument was, this is so simple and easy for your small scripts lying around - why not use it. I was initially daunted by all of the commands and things you could do when I had looked at it years ago but the author distilled it down to a handful of commands. I am going to distill it down further:

1) Check in and unlock your program (leaving a copy):
$ ci -u program
2) To edit, check out and lock your program:
$ co -l program
3) View your revision logs:
$ rlog program

So far, that works well enough for me. Be sure to read the whole 5 Minute RCS Tutorial (see link above). I wish I had used this on my most recent, arduous LDAP programming job. Instead made numbered versions and left them lying all over. I then had to open them to see why this one was named program-4 and how it differed from program-3, etc. I know - silly. Should've stuck with this when I looked at in in 1997 (Hey! I remember the project that caused me to consider rcs then - that's not weird!)


  1. Just so the people reading the ironman feed don't get the right idea, RCS is /not/ recommended, nor is it best practice in modern software development, regardless of language. There is a reason a plethora of other version control suites have been written. They all execute infinity times better than RCS. Please don't tell people using RCS is a good idea.

  2. I agree with the author - if you're just writing small sysadmin scripts for yourself, it's easy and handy. And, as in my case, if you're not using anything else, it's infinitely better than nothing. It wouldn't work for collaborative web projects at all but it met my needs.

  3. I used to use RCS for simple things too, but I use Mercurial for that now. You said it's overkill, but I don't really see why. Day to day usage is dead simple.

    1) Create a repo in cwd: "hg init"
    2) Add files to the repo: "hg add"
    3) Save changes to repo: "hg commit"
    4) View the commit log: "hg log"

    That's all you need most of the time. It's lightning fast and keeps everything tucked away in a single .hg directory. I don't see any advantage left for RCS.

  4. I find that RCS is excellent when used for config files, and other files owned by a package manager. If I'm editing my apache conf, or my fstab, I just hit C-x vv in emacs, and I'm off. It creates the RCS directory, and checks the initial copy in. C-x vv again, and it is checked out and ready to edit.

    Finding out how a machine has been altered from the standard packages in the distro? Just find -type d -name RCS, and you have a list.

    I might use it for the odd script, but anything which I might share goes to CVS/SVN/git.