home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / radi116c.zip / radius116c / runstats / getwhoson.cmd next >
OS/2 REXX Batch file  |  1999-01-21  |  899b  |  35 lines

  1. /* Rexx file callable from MRTG to extract RUNSTATS output file data */
  2.  
  3.   logfile="c:\runstats\runstats.log"
  4.  
  5.   total=0
  6.  
  7.   fileSize=CHARS(logfile)
  8.   if fileSize > 0 THEN DO
  9.    error=STREAM(logfile, 'C', 'seek ='fileSize-100)
  10.    DO WHILE LINES(logfile) > 0
  11.      line=linein(logfile)
  12.  
  13.      parse VAR line '[' yy '/' mm '/' dd ':' hh ':' min ':' ss ']' line
  14.      if (line <> "") then do
  15.         line=STRIP(line,"B")
  16.         total=0
  17.         DO WHILE (line <> "")
  18.           parse VAR line serverCount line
  19.           if serverCount <> "" then do
  20.              total=total+serverCount
  21.           end
  22.         END
  23.      end
  24.  
  25.    END
  26.    /* Here 'total' contains the number of users on the last line */
  27.    error=STREAM(logfile, 'C', 'CLOSE')
  28.   end
  29.  
  30. say total
  31. say total
  32. /* Make up an uptime rather than calculating this out... */
  33. say time(s)+(date(d)*3600*24)
  34. Say "Dialup server"
  35.