Webpage Display

Hi,
I need to display the output of a script in web page. Can anyone suggest me how to do that?

Just have the script out saved to /var/apache2/htdocs. You probably want to make sure apache is running too.

What script? PHP? CGI? Javascript?

Its just a Unix shell script :slight_smile: It contains the CPU Utilisation, Memory and disk usage,etc. We need to redirect the output to a web page.

---------- Post updated at 03:53 PM ---------- Previous update was at 03:23 PM ----------

Just have the script out saved to /var/apache2/htdocs. You probably want to make sure apache is running too.

Hi,
How can i check whether apache server is running. I checked the directory u have mentioned and it exists. Can you please explain little more clear what to do?

Here is an example creating an HTML page for the date using bash:

#!/bin/bash
DATE="$(date)"
OUTPUT=$OUTPUT"<html><head>\n"
OUTPUT=$OUTPUT"<title>Demo HTML for Date</title>\n"
OUTPUT=$OUTPUT"</head><body>\n"
OUTPUT=$OUTPUT"Today is $DATE <br>\n"
OUTPUT=$OUTPUT"</body></html>\n"
printf "$OUTPUT " > /tmp/date.html

You can use the ps and the grep command to see if a process is running...

1 Like

Current status of the apache service.

svcs -p /network/http:apache2

Start the apache service and have it automatically restart if the system if rebooted.

svcadm -v enable /network/http:apache2

Note, BEFORE you start apache, make sure you've got a valid httpd.conf file.

cd /etc/apache2
cp httpd.conf-example httpd.conf

That's the default. It's not very secure but it will get the job done for internal use.

That should get you started... Post back if you have any questions.

1 Like