|
|
1.1 ! root 1: From [email protected] (Brian Reid) Sat Mar 8 14:46:58 1986 ! 2: Path: seismo!ut-sally!pyramid!decwrl!glacier!reid ! 3: From: [email protected] (Brian Reid) ! 4: Newsgroups: net.news.adm,net.news.group ! 5: Subject: who reads USENET, anyhow? Worldwide survey. ! 6: Message-ID: <[email protected]> ! 7: Date: 8 Mar 86 19:46:58 GMT ! 8: Organization: Stanford University, Computer Systems Lab ! 9: Lines: 169 ! 10: Keywords: please run this program on your site ! 11: ! 12: ! 13: I'm tired of speculation about how many people read USENET, and how big the ! 14: audiences are. Here is a program that does a pretty good job of determining ! 15: that information. Please install this program on your site, and run it with ! 16: the -m option that will mail the results back to glacier. I will tally and ! 17: total the results and post them. We've been running this program at about ! 18: 20 sites in the San Francisco area for 6 months now, and the results are ! 19: remarkably counterintuitive. ! 20: ! 21: This shell script is named "arbitron". Edit the "configuration information" ! 22: to work at your site, then type ! 23: arbitron -m [email protected] ! 24: to mail the results to me. If you want to keep a copy of the results, type ! 25: arbitron -m "netsurvey@glacier myname" ! 26: where "myname" is your login name. ! 27: ! 28: On Glacier, which is a Vax 750 with 250 user accounts, this program takes ! 29: about 5 minutes to run on a lightly-loaded system. ! 30: ! 31: #! /bin/sh ! 32: # arbitron -- this program produces rating sweeps for USENET. ! 33: # ! 34: # Usage: arbitron > filename for local data ! 35: # arbitron -p net.foo to post to USENET ! 36: # arbitron -m person to mail results to an accumulator ! 37: # ! 38: # Run "arbitron -p" at the end of each month, which will post your site's ! 39: # arbitron report. ! 40: # To participate in the international monthly ratings sweeps, ! 41: # run "arbitron -m net-survey@glacier" every month. I combine the results ! 42: # and post the information to net.news. ! 43: # ! 44: # The names of users reading individual groups are not posted to the network, ! 45: # only the summary counts. Whether or not somebody reads a group is private ! 46: # information. ! 47: # ! 48: # By Brian Reid, Stanford. ! 49: # v1.2 September 18, 1985 ! 50: # v1.3 March 8, 1986 ! 51: # ! 52: # copied to a certain extent from the "subscribers" ! 53: # script posted by Blonder, McCreery, and Herron. The awk script to format ! 54: # the report was especially stolen from them. ! 55: ############################################################################ ! 56: # Configuration information: ! 57: tmpdir=/tmp ! 58: news=/usr/lib/news ! 59: ! 60: # For uucp, try {sun, pyramid, decwrl, hplabs, bellcore}!glacier ! 61: summarypath="[email protected]" ! 62: hostname=`hostname` ! 63: PATH=$news:/usr/local/bin:/usr/ucb:/usr/bin:/bin ! 64: ############################################################################ ! 65: export PATH ! 66: # --------------------------------------------------------------------------- ! 67: trap "rm -f $tmpdir/arb.sel.$$ $tmpdir/arb.fmt.$$ $tmpdir/arb.tmp.$$" 0 1 2 15 ! 68: opt1=${1-0} ! 69: case $opt1 in ! 70: -p) opt2=${2-ba.news.ratings};; ! 71: -m) opt2=${2-netsurvey@glacier};; ! 72: esac ! 73: set `date` ! 74: dat="$2 $6" ! 75: moption=0 ! 76: case $opt1 in ! 77: -p) destination="$news/inews -t Monthly arbitron ratings for $hostname ($dat) -n $opt2" ! 78: poption=1;; ! 79: ! 80: -m) destination="mail $opt2" ! 81: moption=1; ! 82: poption=1;; ! 83: *) destination="cat" ! 84: poption=0 ! 85: esac ! 86: ################################ ! 87: # Here are several expressions, each of which figures out approximately how ! 88: # many people use this machine. Comment out all but 1 of them; pick the one ! 89: # you like best ! 90: ########## fast but usually returns too big a number ! 91: lowUID=5 ! 92: highUID=999 ! 93: nusers=`awk -F: "BEGIN {N=0}\\$3>=$lowUID && \\$3<=$highUID{N=N+1}END{print N}" </etc/passwd` ! 94: ########## slow but accurate if /usr/adm/wtmp has enough data ! 95: ## wc is a Berkeley-ism, I think. We just want to count the lines in the ! 96: ## standard output of sort -u ! 97: # set `last | colrm 9 | sort -u | wc` ! 98: # nusers=$1 ! 99: ################################ ! 100: cat > $tmpdir/arb.sel.$$ << 'CAT' ! 101: /^net\..*: *[0-9].*$/ { nn=split($0,n,":"); print n[1], n[2] } ! 102: /^mod\..*: *[0-9].*$/ { nn=split($0,n,":"); print n[1], n[2] } ! 103: NF == 1 && $1 ~ /^[a-z]*$/{ print $1 } ! 104: CAT ! 105: sed -e "s/POPTION/$poption/" -e "s/MOPTION/$moption/" -e "s/NUSERS/$nusers/" -e "s/HOSTNAME/$hostname/" > $tmpdir/arb.fmt.$$ << 'DOG' ! 106: # makereport -- utility for "arbitron". Shamelessly copied from the ! 107: # similar script distributed with "subscribers.sh" by Blonder, McCreery, and ! 108: # Herron. ! 109: # ! 110: BEGIN { rdrcount = 0 ; reader = "" ; grpcount = 0 ; realusers = 0} ! 111: ! 112: NF == 4 { # 4 fields means it is a /usr/lib/news/active entry ! 113: grpcount++ ! 114: grpname[grpcount] = $1 ! 115: grpnumber[$1] = grpcount ! 116: grplast[grpcount] = $2 ! 117: grpfirst[grpcount] = $3 ! 118: grpcounts[grpcount] = 0 ! 119: grpreaders[grpcount] = "" ! 120: } ! 121: # 1 field means it's a user name ! 122: NF == 1 { rdrcount++; rdrname[rdrcount] = $1; rdrnumber[$1] = rdrcount ! 123: reader = $1} ! 124: ! 125: # 2 fields means it's a .newsrc line ! 126: NF == 2 { gnum = grpnumber[$1] ! 127: n1 = split($2, n2, "-") ! 128: n3 = split(n2[n1], n4, ",") ! 129: lastread = n4[n3] ! 130: if (lastread >= grpfirst[gnum]) { ! 131: grpcounts[gnum]++ ! 132: grpreaders[gnum] = (grpreaders[gnum] " " reader) ! 133: if (realuser[rdrcount] == 0) { ! 134: realuser[rdrcount]=1 ! 135: realusers++ ! 136: } ! 137: } ! 138: } ! 139: ! 140: END {bigblanks = " " ! 141: printf("9999 Host\t\t%s\n","HOSTNAME") ! 142: printf("9998 Users\t\t%d\n",NUSERS) ! 143: printf("9997 NetReaders\t%d\n",realusers) ! 144: if (0 == MOPTION) printf("9996 \n9995 rdrs rating share traffic M/R newsgroup\n") ! 145: for (i=0; i < grpcount; i++) { ! 146: if (grpcounts[i] > 0) { ! 147: rating = (100*grpcounts[i])/NUSERS ! 148: share = (100*grpcounts[i])/realusers ! 149: traffic = grplast[i]-grpfirst[i] ! 150: if (grpcounts[i] != 0) ratio = traffic/grpcounts[i] ! 151: else ratio = 0 ! 152: if (0 == POPTION) { ! 153: obuf = sprintf("%4d %5d %s", grpcounts[i], traffic, grpname[i]) ! 154: nf = split(grpreaders[i], rdrs, " ") ! 155: obuf = substr ((obuf bigblanks),1,35) ! 156: width = 35 ! 157: for (j=1; j <= nf; j++) { ! 158: nwidth = length(rdrs[j]) ! 159: obuf = (obuf rdrs[j] " ") ! 160: width = length(obuf) ! 161: } ! 162: } else if (0 == MOPTION) { ! 163: obuf = sprintf("%4d %5.1f%% %4d%% %5d %5.1f %s", grpcounts[i], rating, share, traffic, ratio, grpname[i]) ! 164: } else { ! 165: obuf = sprintf("%d %s\n",grpcounts[i], grpname[i]) ! 166: } ! 167: printf("%s\n",obuf) ! 168: } ! 169: } ! 170: } ! 171: DOG ! 172: ! 173: awk -F: '{printf "echo %s\negrep : %s/.newsrc\n",$1,$6}' \ ! 174: </etc/passwd | sh 2>/dev/null | awk -f $tmpdir/arb.sel.$$ >$tmpdir/arb.tmp.$$ ! 175: egrep '^net\.|^mod\.' $news/active | sort | \ ! 176: awk -f $tmpdir/arb.fmt.$$ - $tmpdir/arb.tmp.$$ | sort -nr | \ ! 177: sed -e 's/^999[0-9] //' | $destination ! 178: -- ! 179: Brian Reid decwrl!glacier!reid ! 180: Stanford [email protected] ! 181: ! 182:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.