A couple of weeks ago I was bitten by the Ruby bug. I’m not entirely certain why. From my perspective the language isn’t terribly intuitive. The default library that comes with it is huge, and there’s alot of stuff that can be done pretty quickly using it. For example, here’s a really simple script that can be used to calculate when your mount point will be full:
#!/usr/bin/ruby require "time" startdate = Time.parse( ARGV[0] )
startsize = ARGV[1].to_i
enddate = Time.parse( ARGV[2] )
endsize = ARGV[3].to_i
maxsize = ARGV[4].to_i
growthrate = (( endsize - startsize ) / ( enddate - startdate ))
maxdate = (( maxsize - endsize ) / growthrate )
p ( enddate + maxdate )
Here’s I’m running it with arguments that indicate the total size of my mount point was 123456 bytes on Jan 1st and 234567 bytes on Jan 31st. The maximum size for this mount point is 678900 bytes.
$ ./diskspace.rb "2006-01-01" 123456 "2006-01-31" 234567 678900
Wed May 31 00:16:50 -0600 2006
According to the output I’m either going to have to grow my volume or remove some data by May 31st.