45f855e33e
been sent, and/or that it is disabled and how to enable it ... Submitted by: Paul Schmehl <pauls@utdallas.edu>
91 lines
2.5 KiB
Bash
91 lines
2.5 KiB
Bash
#!/bin/sh -
|
|
#
|
|
# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/Attic/300.statistics,v 1.8 2006-08-09 16:21:30 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
|
|
source_periodic_confs
|
|
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://$checkin_server/scripts/$1"
|
|
}
|
|
|
|
checkin_server="bsdstats.hub.org";
|
|
|
|
case "$monthly_statistics_enable" in
|
|
[Yy][Ee][Ss])
|
|
HN=`/bin/hostname`
|
|
SYS=`/usr/bin/uname -r`
|
|
ARCH=`/usr/bin/uname -m`
|
|
do_fetch getid.php?hn=$HN\&sys=$SYS\&arch=$ARCH\&opsys=$OS
|
|
echo "Posting monthly OS statistics to $checkin_server"
|
|
case "$monthly_statistics_report_devices" in
|
|
[Yy][Ee][Ss])
|
|
IFS="
|
|
"
|
|
|
|
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`
|
|
do_fetch report_device.php?driver=$DRIVER\&vendor=$VEN\&device=$DEV\&hn=$HN
|
|
done
|
|
echo "Posting monthly device statistics to $checkin_server"
|
|
|
|
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
|
|
echo "Posting monthly CPU statistics to $checkin_server"
|
|
|
|
;;
|
|
*)
|
|
echo "Posting monthly device/CPU statistics disabled"
|
|
echo " set monthly_statistics_report_devices=yes in /etc/periodic.conf"
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
echo "Posting monthly OS statistics disabled"
|
|
echo " set monthly_statistics_enable=yes in /etc/periodic.conf"
|
|
;;
|
|
esac
|
|
|
|
umask $oldmask
|
|
exit $rc
|