tags:

views:

15

answers:

0

Hi,

I have this Bash Script:

#! /usr/local/bin/bash
SCGI_SOCKET=unix:///tmp/rpc.socket
echo -n rT $(rtxmlrpc system.client_version)/$(rtxmlrpc system.library_version)
echo -n \ [$(rtcontrol -qosize \* | awk '{ SUM += $1} END { print SUM/1024/1024/1024 }') GiB loaded]
echo -n , D:$(rtxmlrpc to_mb $(rtxmlrpc get_down_total)) MiB
echo -n \ @ $(rtxmlrpc to_kb $(rtxmlrpc get_down_rate)) 
echo -n \ / $(rtxmlrpc to_kb $(rtxmlrpc get_download_rate)) KiB/s
echo -n , U:$(rtxmlrpc to_mb $(rtxmlrpc get_up_total)) MiB
echo -n \ @ $(rtxmlrpc to_kb $(rtxmlrpc get_up_rate)) 
echo -n \ / $(rtxmlrpc to_kb $(rtxmlrpc get_upload_rate)) KiB/s

It runs fine, however it exits as soon as its complete.
How can I force it to "pause" with the results all as they should be?
It works fine if I output it to a file like so:

 # bash rt.sh > index.html 

Basically, I'm accessing this shell script via a cgi-bin directory. It's setup correctly, but it returns a HTTP 500 error when I access this script...which im guessing is because of the abrupt exit at the end (ie. it outputs nothing). I tested this theory with a simple bash script with this:

#! /usr/local/bin/bash
echo "test"

This outputted "test" in my browser...which means the cgi-bin is working correctly, its my main bash script causing the HTTP 500.

Thanks