#!/usr/bin/ruby #Ruby script for showing number of users connected via SSH #Designed for use with conky, could intergrated with anything #Design: Netstat --->Determine Connection Number--->If 1 connection show that one, if more than one, or 0 show the number #Created by Bladdo, Bladdo.Net, Miles@Bladdo.Net or Bladdo@Bladdo.Net netstat = `netstat | grep ssh` array = netstat.split('\n') count = 0 array.each { |trash| count +=1 } ##Print is option, for use with conky i dont because I want to make SSH: a different color #print "SSH:" if count == 1 then new = array[0].split(':ssh ') brandnew = new[1].split(':') puts brandnew[0] else puts count end