One can take advantage of the
finstall_ftp functionality on the A140/A540 STBs to download a bourne shell script, run the iperf utility, and post the results, say, back to an HTTP server on the network. This offers are more automatic way of running iperf on a STB. And is especially useful for deployments where telnet/ssh access to the STB is not easily available.
Example scenario: An A140 STB configured to periodically retrieve its content from an external FTP Server. Here a user can post the iperf STB binary (available to customers as part of routine maintenance) to the FTP content directory; where it will be retrieved by the STB and downloaded.
The customer can then post a file named
finstall_ftp in the same content directory on the same FTP Server. The STB will download it just like any other content file. But after downloading finstall_ftp the STB will
launch it (i.e., mark it as executable and execute it). This is a generic feature of the STB offering a customer an automated way to add local processing using bourne shell or microperl scripting (interpreters supported on the A140/A540). With each file downloaded, the STB looks to see if finstall_ftp is present locally and, if it is, it launches finstall_ftp passing the name of the file just loaded as an argument (e.g., /PVR/finstall_ftp /PVR/file_just_loaded.dat).
Here is an example, certified, finstall_ftp file. It runs iperf and posts the result back to an HTTP Server (example address 192.168.1.45):
- Code: Select all
#!/bin/sh
#Only run this if we just downloaded finstall_ftp
if [ $1 = "/PVR/finstall_ftp" ]; then
IPERF_BIN=/PVR
[ -f /mnt/nv/iperf ] && IPERF_BIN=/mnt/nv
chmod +x ${IPERF_BIN}/iperf
libconfig-get NORFLASH.SERIAL_ID > /PVR/iperf_result.txt
date >> /PVR/iperf_result.txt
${IPERF_BIN}/iperf -c 192.168.1.45 >> /PVR/iperf_result.txt
curl -T /PVR/iperf_result.txt http://192.168.1.45/Uploads/receive.pl
fi
exit 0
IMPORTANT: The finstall_ftp file must be created using Unix/Linux end-of-line formatting. Be careful to avoid DOS/Windows/MAC formatting as these formats will not execute on the Linux STBs.In this example the HTTP Server at 192.168.1.45 is running IIS7 (but most any Web Server will work). Here is the perl program up on the server which accepts the HTTP POST of the iperf results and places the results in a local file:
- Code: Select all
# upload a file
read (STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
$buffer_size = length ($buffer);
# create a file name in the local directory
$fnsave = $$;
open (HERE,">$fnsave");
print HERE $buffer;
# Generate the output page
$now = localtime();
print << "REPLYPAGE"
Content-type: text/html
<BODY BGCOLOR=white text=black>
<H2>Your page has been uploaded and saved
as $fnsave</H2>
Buffer size is $buffer_size bytes<BR>
$now
</BODY>
REPLYPAGE
;