If Amazon didn’t make it so hard to recommend buying a book from them, I’d post a link to Practical Ruby for System Administration. I purchased a copy a couple of weeks ago, and just finished reading it. You can find a sample chapter at the publisher’s site.
It’s a nice manageable-sized book full of ideas about how you can you Ruby to get things done on your system. Obviously it would be most valuable to full-time system admins, but people like me who administer a handful of systems as a sideline or even as a hobby can benefit from it. There are a number of smallish tasks that I’d like to script but which would be too much effort in bash.
The book begins (page 15) with a ton of one-liners, which is a nice way to see ruby’s power, but which also makes you think, “should I be using ‘find ... | while read ; do ...
‘ here, or ruby? That’s a feeling I never had before; I always move from interactive commands to the shell to tiny shell scripts to bigger scripts and finally realize I need to move to ruby. It’s interesting to see this approach, which I would imagine gets the job done sooner because you quit using the shell sooner.
The chapter on performance measuring doesn’t really matter to me because if I can write a script to do something at all, it will be a net improvement over me doing it by hand. I can imagine serious admins caring, though.
The place where I first said, “whoa!” is the actually fairly late in the book. Hamou has a section on using ruby to automate access to the web-based admin interfaces of the odd bits of hardware on your network. This is the kind of thing that serious network admins get SNMP-enabled hardware to do. I don’t have any of that, but with a few dozen lines of Ruby I could do the same thing with the DSL modem, a wireless router, and a printer on my home network. There’s something cool about the idea of connecting up to them in a cron job to check the status on an hourly basis, logging it to a database, and generating reports with pretty charts. I don’t need to do it, but this book tells me how I could (web-console access, database logging, and graphing) if I wanted.
It doesn’t have much to do with Rails, but it’s buzzword-compliant in the other areas: gems, rake, automated testing, embedded documentation, YAML for configuration, etc.