Ich habe das Script ein bisschen usefreundlicher gemacht, mount point
ins /tmp verlägt, da es Image Platzer gibt falls kein Mount steht, wenn
man /tmp (Ram Speicher) voll schreibt ist nach Reset wieder alles im Lot,
dasselbe wenn Mount OK war aber in der Zwischenzeit der Rechner mal
ausgeschaltet wurde, in dem Fall sucht sich die Box den Mount tot und
irgedwann mal gibt sie auf und schreibt wieder ins Flash, das Script prüft
ob Mount steht, es wird abgefragt ob im /exportdir (das PC Verzeichnis was man normallerweise für Movie Aufnahmen freigegeben hat) die Datei "mount_ok" existiert (bitte anlegen), fals ja wird dann das Script
ausgeführt.
#!/bin/sh
# IP of your NFS server
serverip=192.168.0.2
# exported directory on your NFS server
exportdir=/movie
# mount point on dbox
dboxmountpoint="/tmp/hdd/movie"
# filesize to transfer in MBytes.
# At least 8 MByte. Good values are 32 or 64 MByte.
# Try 128 to be more accurate (takes much longer!)
filesize=32
# block sizes to test in KBytes, possible values are 1 2 4 8 16 32.
# values have to be separated with spaces. See examples below.
# blocksizelist="4 8 32"
# blocksizelist="16"
blocksizelist="4 8 16 32"
# wether to enable synchronous reading, writing. Possible values are "yes"
# or no. Normally synchronous reading or writing should be slower than
# asynchronous, so to save some time most people would say "no" here.
enablesynctests="no"
##################################################################
######## don't edit below this line ########
##################################################################
bs=8192
count=`expr $filesize \* 1048576 / $bs`
wlist=""
rlist=""
synctests="async"
if [ $enablesynctests = "yes" ]; then
synctests="sync "$synctests
fi
# just for checking mount, touch in your /export dir (on your PC) a file emount_ok e
if [ -e $dboxmountpoint/mount_ok ] ; then
echo
echo "Measuring NFS throughput..."
for factor in $blocksizelist
do
for protocol in udp tcp
do
for synchronized in $synctests
do
size=`expr $factor \* 1024`
bitcount=`expr $bs \* $count \* 8`
umount $dboxmountpoint 2>/dev/null
mount -t nfs -o rw,soft,$protocol,nolock,$synchronized,rsize=$size,wsize=$size $serverip:$exportdir $dboxmountpoint
echo "Mount options: "$protocol", "$synchronized", wsize="$size
echo "writing "$filesize" MBytes..."
a=`date +%s`
dd if=/dev/zero of=$dboxmountpoint/test bs=$bs count=$count 2>/dev/null;
if [ $? = "0" ]
then
z=`date +%s`
duration=`expr $z - $a`
throughput=`expr $bitcount / $duration`
echo "Success after "$duration" seconds"
else
throughput="Failure"
echo "Failure"
fi
wlist=$wlist$throughput" with "$protocol","$synchronized",wsize="$size"\n"
echo "Mount options: "$protocol", "$synchronized", rsize="$size
echo "reading "$filesize" MBytes..."
a=`date +%s`
dd of=/dev/null if=$dboxmountpoint/test bs=$bs count=$count 2>/dev/null;
if [ $? = "0" ]
then
z=`date +%s`
duration=`expr $z - $a`
throughput=`expr $bitcount / $duration`
echo "Success after "$duration" seconds"
else
throughput="Failure"
echo "Failure"
fi
rlist=$rlist$throughput" with "$protocol","$synchronized",rsize="$size"\n"
echo
echo "Results for write throughput:"
echo $wlist | sort -nr | sed 's/^\([0-9]*\)\([0-9]\{3\}\)\([0-9]\{3\}\(.*\)\)/\1.\2 Mbit\/s\4/g'
echo "Results for read throughput:"
echo $rlist | sort -nr | sed 's/^\([0-9]*\)\([0-9]\{3\}\)\([0-9]\{3\}\(.*\)\)/\1.\2 Mbit\/s\4/g'
else
echo
echo "no Mount, did You mount! touch in the exported directory"
echo "on your PC a file emount_ok e just for checking the mount"
echo
/bin/wget -q -O /dev/null
http://localhost/control/message?no%20M ... %20file%20 emount_ok e%20just%20for%20checking%20the%20mount
fi
exit;
oder das ganze zum Herunterladen:
http://www.speedyshare.com/588650824.html
mrvica