LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   issue with shell cgi (https://www.linuxquestions.org/questions/programming-9/issue-with-shell-cgi-8381/)

JustinHoMi 11-07-2001 01:54 AM

issue with shell cgi
 
I'm writing a simple cgi to monitor some things on my system that I check constantly. It's just a shell script, but the problem I'm having is that some of the output doesn't show up on the webpage (the stuff marked "#from here #to here"). If i redirect everything to a file, it views fine on the web. And if I run it on the command line, it outputs fine. It just won't view the marked part on the web. Here's part of the code:

###########################
echo Content-type: text/html
echo

echo "<html><body>"
echo "<b>Halflife process:</b><br>"
ps aux | grep hlds | grep game
echo "<br><br>"
echo "<b>Punkbuster process:</b><br>"
ps aux | grep pb | head -n 1
echo "<br><br>"
echo "<b>Halflife status:</b><br>"

# from here
temp=/usr/jmtemp.$$
kkstat > $temp
num=`wc -l $temp | awk -F" " '{print $1}'`
x=1
while [ $x -le $num ]
do
currline=`head -n $x $temp | tail -n 1`
echo $currline
echo "<br>"
x=`expr $x + 1`
done
# to here

echo "</body></html>"

#######################

kkstat is a small script that logs into my halflife server and outputs a list of player name and status. It takes about 1/3 of a second to run.

Any ideas as to what's going on? It's as if programs that take up just a snippet of cpu time won't output properly.

Any help'd be great :)

Thanks,
Justin


All times are GMT -5. The time now is 11:35 AM.