Re: Just the hacks, ma'am
Article: 4932 of alt.hackers Newsgroups: alt.hackers From: A.Main@dcs.warwick.ac.uk (Zefram) Subject: Re: Just the hacks, ma'am X-Nntp-Posting-Host: stone Message-ID: 1995Jun9.173657.13292@dcs.warwick.ac.uk Sender: news@dcs.warwick.ac.uk (Network News) Organization: Department of Computer Science, Warwick University, England Date: Fri, 9 Jun 1995 17:36:57 GMT Approved: a tad more so than that MAKE.MONEY.FAST post, one suspects Lines: 49 Status: RO
Nice script. Here's my version: ############################### #!/bin/sh # # lossage # # DWF 6/6/95, drz 6/6/95 (but later that day), Zefram 1995-06-09 # # Usage: lossage sitename [interval] # interval=260 case $# in 1) ;; 2) interval=$2;; *) echo "Usage: lossage sitename [interval]"; exit 1;; esac echo " Dead Alive" echo "Time | 1 2 3 4 5 6 7 8 9 |" while true; do LOSSAGE=`ping -s $1 56 40 | fgrep "bytes from" | while read a; do echo -n '#'; done` echo "`date` $LOSSAGE" sleep $interval done ############################### This uses slightly fewer processes, and doesn't rely on bash's built in arithmetic. You'll notice that the ping syntax is different; it's what works on this system (SunOS 4.1), so you may need to modify it. ObAncientHack: This was waaaay back when I was using VMS, on a VAX mainframe. Well, about seven years back, to be a little more precise. There was a command that would show all the processes running on the machine, including the numeric GID and UID of the process' owner. There was no option to show this as a real username, and no command to convert between numeric and alphanumeric UIDs. (I believe there were system calls that would do it, but the VMS application/OS interface is a bit of a nightmare, and I didn't need the conversion very often.) Inevitably, once or twice I wanted to know who was running a particular process, so I came up with a hack that would turn a numeric UID into a username. I would create an ACL (Access Control List) on a file, putting the mysterious UID into it. Then save the ACL, and list it with DIR /FULL. It would show up as a username. -zefram