How to embedded Unix command in html (40 Views)
Reply
Advisor
ashan
Posts: 28
Registered: ‎12-09-2002
Message 1 of 6 (40 Views)

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

Please use plain text.
Honored Contributor
Zeev Schultz
Posts: 763
Registered: ‎03-05-2002
Message 2 of 6 (40 Views)

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
Please use plain text.
Honored Contributor
Massimo Bianchi
Posts: 2,472
Registered: ‎01-18-1999
Message 3 of 6 (40 Views)

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
Please use plain text.
Honored Contributor
Francisco J. Soler
Posts: 378
Registered: ‎06-15-1999
Message 4 of 6 (40 Views)

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.
Please use plain text.
Honored Contributor
Zeev Schultz
Posts: 763
Registered: ‎03-05-2002
Message 5 of 6 (40 Views)

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
Please use plain text.
Occasional Visitor
Philippe MALINGE
Posts: 3
Registered: ‎11-21-2000
Message 6 of 6 (40 Views)

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
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation