diff options
author | Marc G. Fournier <scrappy@FreeBSD.org> | 2006-08-09 02:37:09 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@FreeBSD.org> | 2006-08-09 02:37:09 +0000 |
commit | 935f9e7043e7d84f0bfe9a04f8930131339be5a4 (patch) | |
tree | 4858a406a57afc176f0490ec060a06ef2f56947f /sysutils/bsdstats | |
parent | 84e9dab56c0a5dfa95ceac55c7ed681ae1006198 (diff) | |
download | ports-935f9e7043e7d84f0bfe9a04f8930131339be5a4.tar.gz ports-935f9e7043e7d84f0bfe9a04f8930131339be5a4.zip |
Notes
Diffstat (limited to 'sysutils/bsdstats')
-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 ;; |