diff options
author | scrappy <scrappy@FreeBSD.org> | 2006-08-09 10:37:09 +0800 |
---|---|---|
committer | scrappy <scrappy@FreeBSD.org> | 2006-08-09 10:37:09 +0800 |
commit | ba04d71d5a076023b4d0cb77e06fb729ab3bfc8f (patch) | |
tree | 4a95792ec86a30ee61c50bdc97ebf21150ffabc3 /sysutils | |
parent | a7bd0e64bd6d54c9ac08a6ef1b66a2fd4f8b77c1 (diff) | |
download | freebsd-ports-gnome-ba04d71d5a076023b4d0cb77e06fb729ab3bfc8f.tar.gz freebsd-ports-gnome-ba04d71d5a076023b4d0cb77e06fb729ab3bfc8f.tar.zst freebsd-ports-gnome-ba04d71d5a076023b4d0cb77e06fb729ab3bfc8f.zip |
Add CPUs to the devices report, and clean up the script a bit
Submitted by: Matthew Seaman <m.seaman@infracaninophile.co.uk>
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/bsdstats/Makefile | 3 | ||||
-rw-r--r-- | sysutils/bsdstats/files/300.statistics | 46 | ||||
-rw-r--r-- | sysutils/bsdstats/files/300.statistics.in | 46 |
3 files changed, 83 insertions, 12 deletions
diff --git a/sysutils/bsdstats/Makefile b/sysutils/bsdstats/Makefile index 7819195f7611..de3d6cb13faa 100644 --- a/sysutils/bsdstats/Makefile +++ b/sysutils/bsdstats/Makefile @@ -6,8 +6,7 @@ # PORTNAME= bsdstats -PORTVERSION= 2.0 -PORTREVISION= 5 +PORTVERSION= 2.1 CATEGORIES= sysutils DISTFILES= diff --git a/sysutils/bsdstats/files/300.statistics b/sysutils/bsdstats/files/300.statistics index 9fee0240f239..0ec444ad12a1 100644 --- a/sysutils/bsdstats/files/300.statistics +++ b/sysutils/bsdstats/files/300.statistics @@ -1,10 +1,11 @@ #!/bin/sh - # -# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/Attic/300.statistics,v 1.6 2006-08-08 04:32:21 scrappy Exp $ +# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/Attic/300.statistics,v 1.7 2006-08-09 02:37:09 scrappy Exp $ # # If there is a global system configuration file, suck it in. # +monthly_statistics_mailto="scrappy@hub.org,root" if [ -r /etc/defaults/periodic.conf ] then . /etc/defaults/periodic.conf @@ -14,26 +15,61 @@ fi oldmask=$(umask) umask 066 +# RFC 2396 +uri_escape () { + echo ${1+$@} | sed -e ' + s/%/%25/g + s/;/%3b/g + s,/,%2f,g + s/?/%3f/g + s/:/%3a/g + s/@/%40/g + s/&/%26/g + s/=/%3d/g + s/+/%2b/g + s/\$/%24/g + s/,/%2c/g + s/ /%20/g + ' +} + +do_fetch () { + /usr/bin/fetch -qo /dev/null "http://bsdstats.hub.org/scripts/$1" +} + + case "$monthly_statistics_enable" in [Yy][Ee][Ss]) HN=`/bin/hostname` SYS=`/usr/bin/uname -r` ARCH=`/usr/bin/uname -m` - OS=`/usr/bin/uname -s` - /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/getid.php?hn=$HN\&sys=$SYS\&arch=$ARCH\&opsys=$OS + do_fetch getid.php?hn=$HN\&sys=$SYS\&arch=$ARCH\&opsys=$OS case "$monthly_statistics_report_devices" in [Yy][Ee][Ss]) IFS=" " - /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/clear_devices.php?hn=$HN + do_fetch clear_devices.php?hn=$HN for line in `/usr/sbin/pciconf -l | /usr/bin/grep -v none` do DRIVER=`echo $line | awk -F\@ '{print $1}'` VEN=`echo $line | awk '{print $4}' | cut -c12-15` DEV=`echo $line | awk '{print $4}' | cut -c8-11` - /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/report_device.php?driver=$DRIVER\&vendor=$VEN\&device=$DEV\&hn=$HN + do_fetch report_device.php?driver=$DRIVER\&vendor=$VEN\&device=$DEV\&hn=$HN done + + line=$( sysctl -n hw.model ) + VEN=$( echo $line | cut -d ' ' -f 1 ) + DEV=$( uri_escape $( echo $line | cut -d ' ' -f 2- ) ) + n=0 + count=$( sysctl -n hw.ncpu ) + do_fetch clear_cpu.php?hn=$HN + while [ $n -lt $count ] + do + do_fetch report_cpu.php?cpu_id=CPU$n\&vendor=$VEN\&cpu_type=$DEV\&hn=$HN + n=$(( $n + 1 )) + done + ;; esac ;; diff --git a/sysutils/bsdstats/files/300.statistics.in b/sysutils/bsdstats/files/300.statistics.in index f49bf31d3dc4..b52a348c96cf 100644 --- a/sysutils/bsdstats/files/300.statistics.in +++ b/sysutils/bsdstats/files/300.statistics.in @@ -1,10 +1,11 @@ #!/bin/sh - # -# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/300.statistics.in,v 1.6 2006-08-08 04:32:21 scrappy Exp $ +# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/300.statistics.in,v 1.7 2006-08-09 02:37:09 scrappy Exp $ # # If there is a global system configuration file, suck it in. # +monthly_statistics_mailto="scrappy@hub.org,root" if [ -r /etc/defaults/periodic.conf ] then . /etc/defaults/periodic.conf @@ -14,26 +15,61 @@ fi oldmask=$(umask) umask 066 +# RFC 2396 +uri_escape () { + echo ${1+$@} | sed -e ' + s/%/%25/g + s/;/%3b/g + s,/,%2f,g + s/?/%3f/g + s/:/%3a/g + s/@/%40/g + s/&/%26/g + s/=/%3d/g + s/+/%2b/g + s/\$/%24/g + s/,/%2c/g + s/ /%20/g + ' +} + +do_fetch () { + /usr/bin/fetch -qo /dev/null "http://bsdstats.hub.org/scripts/$1" +} + + case "$monthly_statistics_enable" in [Yy][Ee][Ss]) HN=`/bin/hostname` SYS=`/usr/bin/uname -r` ARCH=`/usr/bin/uname -m` - OS=`/usr/bin/uname -s` - /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/getid.php?hn=$HN\&sys=$SYS\&arch=$ARCH\&opsys=$OS + do_fetch getid.php?hn=$HN\&sys=$SYS\&arch=$ARCH\&opsys=$OS case "$monthly_statistics_report_devices" in [Yy][Ee][Ss]) IFS=" " - /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/clear_devices.php?hn=$HN + do_fetch clear_devices.php?hn=$HN for line in `/usr/sbin/pciconf -l | /usr/bin/grep -v none` do DRIVER=`echo $line | awk -F\@ '{print $1}'` VEN=`echo $line | awk '{print $4}' | cut -c12-15` DEV=`echo $line | awk '{print $4}' | cut -c8-11` - /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/report_device.php?driver=$DRIVER\&vendor=$VEN\&device=$DEV\&hn=$HN + do_fetch report_device.php?driver=$DRIVER\&vendor=$VEN\&device=$DEV\&hn=$HN done + + line=$( sysctl -n hw.model ) + VEN=$( echo $line | cut -d ' ' -f 1 ) + DEV=$( uri_escape $( echo $line | cut -d ' ' -f 2- ) ) + n=0 + count=$( sysctl -n hw.ncpu ) + do_fetch clear_cpu.php?hn=$HN + while [ $n -lt $count ] + do + do_fetch report_cpu.php?cpu_id=CPU$n\&vendor=$VEN\&cpu_type=$DEV\&hn=$HN + n=$(( $n + 1 )) + done + ;; esac ;; |