Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

So how can i get: All system information from Bash cgi script to web site?

share|improve this question

1 Answer

Before any output, your bash CGI script should print a "Content-type" header, for example:

# First output line should be the content-type header + blank line
echo -e "Content/type: text/plain\n"

echo -n "running as: "; whoami

echo "-----------------------------------------"
echo "            /proc/cpuinfo                "
echo "-----------------------------------------"
cat /proc/cpuinfo

echo "-----------------------------------------"
echo "            /proc/meminfo                "
echo "-----------------------------------------"
cat /proc/meminfo

In most apache deployments there is a cgi-bin directory where you should place CGI scripts. Make your script executable (by the user running the webserver) and place it at this directory.

If the user running the webserver has no rights to display the system information you need, you will have to use something like sudo to escalate privileges - be sure to use a very restrictive sudoers file (if you can't sudo, get out of here).

share|improve this answer
 
THanks for that i'll test it today. –  user49597 Aug 1 '12 at 6:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.