开发者

Bash cgi output xmlrpc

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 w开发者_开发百科ith 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


Simply add this directly after the first line:

echo "Content-Type: text/plain; charset=UTF-8"
echo
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜