runnig csh sh bash script

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
svar45
-


Joined: 01 Jul 2003
Posts: 2

PostPosted: Tue Jul 01, 2003 10:20 pm    Post subject: runnig csh sh bash script Reply with quote

Hello!

I want just run something like:

#!/bin/sh

echo "<html><meta content=\"text/html\" encoding=\"koi8-r\"><body text=\"#000088\" bgcolor=\"#FFFFFF\">"
echo "<p><b><font color=\"#FF0000\">`hostname`</font> information page</b></p>"

echo "<p><pre>`w`</pre></p>"

echo "<hr>"
echo "<p>"
echo "<a href=\"tail_console\">console log</a> <br>"
echo "<a href=\"tail_auth\">auth log</a> <br>"
echo "<a href=\"tail_security\">security log</a> <br>"
echo "<a href=\"tail_pppd\">pppd log</a> <br>"
echo "<a href=\"tail_cron\">cron log</a> <br>"
echo "<a href=\"tail_httpd\">httpd log</a> <br>"
echo "<a href=\"tail_ftpd\">ftpd log</a> <br>"

echo "</p>"
echo "<hr>"

echo "<p>Free disk space:</p>"
echo "<pre>`df -h`</pre>"
echo "<br>"

echo "<p>Processes:</p>"
echo "<pre>`ps -x | tr "<>" "[]"`</pre>"
echo "<br>"

echo "<p>Interfaces:</p>"
echo "<pre>`ifconfig | tr "<>" "[]"`</pre>"
echo "<br>"

echo "<p>Interface statistics:</p>"
echo "<pre>`netstat -i | tr "<>" "[]"`</pre>"
echo "<br>"

echo "<p>Routing table:</p>"
echo "<p><pre>`netstat -r | tr "<>" "[]"`</pre></p>"
echo "<br>"

echo "<p>Firewall rules:</p>"
echo "<pre>`ipfw -a l`</pre>"
echo "<br>"

echo "<hr>"

echo "</body></html>"


But I have error 500 :(
Can you send e-mail with correct abyss.conf?
pm1823@yahoo.com


Thank you!
Back to top View user's profile Send private message
os17fan
-


Joined: 21 Mar 2003
Posts: 531
Location: USA

PostPosted: Tue Jul 01, 2003 11:14 pm    Post subject: Reply with quote

I think i know whats going on with this cgi script , i believe its badly coded wrong , if im not mistaking i think you need to put a ; at the end of every line in that cgi for it to work

Im going to go test this cgi for you right now ! 8)


Well I just tested your cgi and i got the same error , but i was told in every cgi program you create , your supposed to add a ; at the end of ever line , i don't know the problem sorry

The error you get is a called a syntex error :!:
_________________
This web server is the best !
Back to top View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Jul 03, 2003 12:50 pm    Post subject: Re: runnig csh sh bash script Reply with quote

You get error 500 because the script is not sending the CGI headers. Insert at the beginning of the script:
Code:

echo "Status: 200 OK"
echo

and all should run fine now.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Omar G
-


Joined: 21 Mar 2003
Posts: 34
Location: Honolulu, Hawai'i

PostPosted: Fri Jul 04, 2003 11:36 am    Post subject: Reply with quote

...and don't forget this, so the browser knows to display it as html

echo "Content-type: text/html";

This goes along with the status code in the previous post. With raw scripts like this, you need to manually add the http headers. These headers are text transmitted before the start of the html page. They are meant for the machine and not the reader.

- Omar G
Back to top View user's profile Send private message
svar45
-


Joined: 01 Jul 2003
Posts: 2

PostPosted: Fri Jul 04, 2003 6:59 pm    Post subject: Reply with quote

Thanx Aprelium! :)

But I still have error 500 in 1/3 cases when script run :(

----------
NO ANSWER NEEDED!!

I just removed /bin/bash fron table of CGI Interpreters.

Thanx again!
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group