#!/bin/sh while read x do (echo 10 k ; who | wc -l; echo 10 / p) | dc done(This may be found in ../pubilc/user.count).
The architecture of the xstrip program (the source code is available) permits easy-to-construct stripcharts for all kinds of statistics. I use this program, along with other shell scripts or C programs that generate the raw statistics, to monitor hits on web servers and to measure network packet loss rates (via the ping program) to remote computers.
The design trade-off of this approach is greater flexibility / ease of programming (I threw together the user-count monitoring script in 2 minutes) at the expense of performance: an integrated C program can provide the stripchart functionality and gather the statistics within the same process image, so there would be no process creation overhead per data point that is the case with the user.count script. Modifying the StripChart Athena widget driver program to do so, however, would have required significantly more programming time.
After talking about the xstrip program, I went over most of the ra_no_ads script, which eliminates advertisement audio tracks from RealAudio RAM files.
#!/bin/sh # # Arg is a .ram file containing .ra entries. # Audionet uses .ram files with two .ra entries, the first of # which is the ad. In almost all cases, it is probably safe # to just use the last entry. # PATH=$PATH:/home/bsy/bin.`/home/bsy/bin/sys`:/home/bsy/bin # pick up upick # RAPLAYER=${RAPLAYER-"$HOME/raplayer3.0.x86_linux200/raplayer"} ## should just be raplayer RAPLAYER=${RAPLAYER-"raplayer"} tmpf=${TMPDIR-/usr/tmp}/ra_no_ads.$$.ram trap "rm -f '$tmpf'" 0 1 2 3 15 case "x$RASELECT" in x|xAUTO) < "$1" sed 's/;.*//;s/ $//;/^$/d' | tail -1 > "$tmpf" ;; xMANUAL) list='' for pnm in `< "$1" sed 's/;.*//;s/ $//;/^$/d'` do list="$list '$pnm'" done list=`xterm -name 'ra_no_ads' -e sh -c "upick $list 1>&3" 3>&1` echo "$list" > "$tmpf" ;; *) echo "RASELECT envariable should be either AUTO or MANUAL" >&2 exit 1 ;; esac $RAPLAYER "$tmpf"I'll finish talking about the 1>&3 and 3>&1 I/O descriptor munging next time.
bsy@cse.ucsd.edu, last updated