From: dagbrown@... (Dave Brown) Date: 2003-09-14T04:41:21+09:00 Subject: Re: Ruby in Systems Administration In article , Mike Wilson wrote: : I was just wondering if anyone had some really cool uses for Ruby in Systems : Administration. Some examples of what I would consider to be really cool is : stuff like using drb or webrick to poll system status, gather inventory : information, etc. I use webrick all the time! Well, I wrote a little script called "quickhttpd" which fires off a web server on some high port which serves up documents in the current directory. This is very handy for all those software packages which come with a pile of HTML, when I don't feel like copying it to an actual web page. Here it is, it's pretty tiny: #!/opt/bin/ruby require 'webrick' port=rand(2048)+8192; server=WEBrick::HTTPServer.new(:Port => port,:DocumentRoot => Dir::pwd, :BindAddress => '0.0.0.0', :AccessLog => [ [ nil, nil ] ], :Logger => WEBrick::Log.new(File.open("/dev/null","w"),nil) ) trap "INT" do server.shutdown; exit ; end print "http://"+`uname -n`.chomp+":#{port}/\n" server.start It outputs the URL of the web page which you can go to to read whatever you were trying to read. It's handy if you're running Unix-type browsers because you can just double-click on the URL in your terminal program, then middle-click on the web browser to go to the URL. In sysadminland, though, mostly I toss off quick one-liners. --Dave