rendered paste body#!/bin/sh
#
# slightly modified virtual penis script
# compatible with the original vpenis.sh
# freebsd support
# darwin support
os=$(uname -s)
uptime=$(uptime | sed 's/.*up[: ]*\([0-9]*\)[ ]*d.*/\1/')
case $os in
Darwin)
cpu=$(echo `sysctl -n hw.cpufrequency`"/10^6*"`sysctl -n hw.ncpu`)
mem=$(echo `vm_stat | awk '/Pages active/ {print $3"*"}'; sysctl -n hw.pagesize`"/(1024^2)")
disk=$(df -k -t nonfs | awk '{if ($1 ~ "/dev/disk"){s+= $2} s+=$2} END {print s}')
;;
FreeBSD)
cpu=$(echo `sysctl -n machdep.tsc_freq`"/10^6*"`sysctl -n hw.ncpu`)
mem=$(echo `vmstat -s | awk '/pages active/ {print $1"*"}'; sysctl -n hw.pagesize`"/(1024^2)")
disk=$(df -k -t nonfs | awk '{if ($1 ~ "/dev/wd"){s+= $2} s+=$2} END {print s}')
;;
Linux)
cpu=$(cat /proc/cpuinfo | awk '/MHz/ {print $4}') # does not consider multiple CPUs?
mem=$(free | awk '/^Mem/ {print $3"/1024"}')
disk=$(df -k -x nfs | awk '{if ($1 ~ "/dev/(scsi|sd)"){s+= $2} s+= $2} END {print s}')
;;
OpenBSD)
cpu=$(echo `sysctl -n hw.cpuspeed`"*"`sysctl -n hw.ncpu`)
mem=$(vmstat | tail -1 | awk '{print $4"/1024"}')
disk=$(df -P -k -t nonfs | awk '!/1k/ {if ($1 ~ "/dev/(scsi|sd)"){s+= $2} s+= $2} END {print s}')
;;
esac
echo "($uptime/10)+($cpu/30)+($mem/3)+($disk/(1024*750))+70" | bc | sed 's/\(.$\)/.\1cm/'