System Administration
Showing results for 
Search instead for 
Do you mean 

How to embedded Unix command in html

Advisor

How to embedded Unix command in html

Hi,

I try create simple html file to list running
process put I can see the command ps -ef only

I may doing wrong ....need your Advice.

Regards

Ashan

my html file looks like..



TEST in uxadmin <BR />


ps -ef

5 REPLIES
Honored Contributor Honored Contributor

Re: How to embedded Unix command in html

All right,you see "ps -ef" since Web browser
sees it as a plain text.To catch result of any OS (incl. UNIX) you need to use scripting inside the HTML,tag is <script></script>.This is a different issue and many ways to implement.I think Perl /CGI is the best one that goes with UNIX.Search on Google (or whatever) for this.

Zeev
So computers don't think yet. At least not chess computers. - Seymour Cray
Honored Contributor Honored Contributor

Re: How to embedded Unix command in html

Hi,
i think your error is that this page is dynamic.

I don't know how to build dynami pages, but you can do the following from unix :

echo "

TEST in uxadmin <BR />

" > test.html
ps -ef >> test.html
echo "
" >> test.html

You can generate this file every tot secons, scheduling it as a cron job.


Then visualize the test.html
with your preferred html viewer.

HTH,
Massimo
Honored Contributor Honored Contributor

Re: How to embedded Unix command in html

Hi Ashan,
if your server support php, you can do it with php:



TEST in uxadmin<BR />


# Begin php code
*** Here you insert php code
# End php code
?>
ps -ef



You can find commands to execute external programs here:
http://www.php.net/manual/en/ref.exec.php

Frank.
Linux?. Yes, of course.
Honored Contributor Honored Contributor

Re: How to embedded Unix command in html

The link for CGI/shell scripts:
http://www.yolinux.com/TUTORIALS/LinuxTutorialCgiShellScript.html
So computers don't think yet. At least not chess computers. - Seymour Cray
Occasional Visitor

Re: How to embedded Unix command in html

Html files are static.
But you can write a small shell script that generate html pages.

In your cgi-bin create the following shell script 'ps.cgi'
(warning : the empty line after text/html is mandatory):

#!/bin/sh

cat <Content-type: text/html


TEST in uxadmin<BR />



EOF

ps -ef

cat <



EOF

Hope this help.
--
Philippe
Fido