Wow! I can't believe how much lobotomy WD has done to the MBWE since the initial release of the Blue Rings edition. I guess they figured that folks were just having to much fun adding functionality to it. My blessings to WD: "May the front lawns of the WD headquarters be fertilized by the dung from one million North American Bison - every other day."
I checked http://mybookworld.wikidot.com/ on how to recover programs lobotomized by WD. Turns out the recovery is only for the Blue Rings edition and I wouldn't recommend trying it on the White Lights edition.
But, I am still undaunted. We have a couple of choices here:
1. I can make the printf program from the Blue Rings edition of the WD MBWE available to you and you can simply FTP it onto your MBWE. Since both editions of the MBWE use the processor from Oxford Semiconductor, that should work.
2. If WD hasn't removed gcc (the "C" compiler), you can download the printf source and make files and compile it back onto your MBWE by using your MBWE - the poetic justice solution. Use the command "type gcc" to see if the MBWE shell can find gcc? (But I suspect WD lobotimized that as well. Did I say 1 million Bison, I meant 2 million Bison and every day!)
3. Use the reworked script that follows. I have removed the requirement for printf - the whole thing relies on using the echo command - not very elegant but what the hey! The script now checks to see if the wdc-fan device can be found where expected. The fan speed only displays if it can be found. You will need to update the HDPARM and the SMARTCTL variables to the location of where these programs are installed on your MBWE white lights edition. The "type hdparm" and "type smartdrv" commands should give you this information. Remember that Linux is case-sensitive.
I have called the reworked script mbstat.sh and copied it into the /root directory of my MBWE from where I run it from the root account as follows:
[root@MyBook01 ~]# sh mbstat.sh
Date: Fri Mar 12 23:10:47 PDT 2010
uptime: 13 days, 23:47 hours
load average: 0.00, 0.00, 0.00
/dev/sda:
drive state is: active/idle
Temperature_Celsius is: 52
/dev/sdb:
drive state is: active/idle
Temperature_Celsius is: 54
Current fan speed (percent): 0
[root@MyBook01 ~]#
(I added the Date:, uptime:, and load average. You will need to check for the existence of the date and uptime programs by using the "type" command (ie: "type date" and "type uptime"). If they have been lobotomized by WD, just comment out the corresponding echo commands in the script.)
The reworked script (mbstat.sh) follows:
#!/bin/sh
# Get disk drive activity, disk temperature, and fan speed
# for the WD myBook World Edition II (Blue Rings)
#
# Identify the two Disks for the WD MB WE II:
DISKS="/dev/sda /dev/sdb"
# Identify the file controlling the WDC fan and speed:
FAN_DEVICE=/sys/devices/platform/wdc-fan
FAN_SPEED=$FAN_DEVICE/speed
# Location of the hdparm and smartctl utilities to be used:
HDPARM=/sbin/hdparm
SMARTCTL=/usr/sbin/smartctl
# note: hdparm version 7.7 is known to work properly on the MBWE
# see
http://kyyhkynen.net/stuff/mybook/spindown.php
# The following tag is used to identify the line within
# the attributes returned by SMARTCTL in order to get
# the internal HD temperature readings.
THE_TEMP="Temperature_Celsius"
echo ""
echo "Date: `date`"
echo " uptime:`uptime | cut -d, -f1-2 | cut -c13-` hours"
echo "`uptime | cut -d, -f4-6`"
for D in $DISKS
do
$HDPARM -C $D
if [ $? -le 1 ] ; then
echo " $THE_TEMP is: `$SMARTCTL -d ata -A $D \
|grep "$THE_TEMP" | cut -c88-`"
fi
done
if test -r "$FAN_SPEED" ; then
echo ""
echo "Current fan speed (percent): `cat ${FAN_SPEED}`"
fi
echo ""
exit