#!/usr/bin/env ruby

require 'socket'


begin
  fd = UNIXSocket.open('/tmp/oasis')
rescue
  print $!, "\n"
  exit 1
end

  fd.send("STATS\r\n", 0)

  foo = fd.readline 
  statline = fd.readline
  f=statline.split()
  print f[0], "\n"
  print f[0], "\n"
  t=f[4].to_i
  d=t/(60*60*24)
  h=(t-d*24)/(60*60)
  m=(t-d*24*60-h*60)/60
  s=(t-d*24*60*60-h*60*60-m*60)

  print d," days, ",h," hours, ",m," minutes\n"
  print "OASIS\n"
