Re: shell scripting (176 Views)
Reply
Super Advisor
Shivkumar
Posts: 1,207
Registered: ‎05-22-2005
Message 1 of 7 (176 Views)

shell scripting

Dear Sirs,

I want to know how to execute a unix command through a browser ?

For example: I want to open a browser and click on some link. The link should go to a unix box and execute a command ( say "bdf"). The output should be displayed in the browser itself.

Please let me know the way how to do it alongwith actual code.

Appreciate your help.

Thanks,
Shiv
Please use plain text.
Honored Contributor
Arunvijai_4
Posts: 4,194
Registered: ‎04-07-2005
Message 2 of 7 (176 Views)

Re: shell scripting

Shiv, one possible way of doing this using cgi scripts. You can use Apache as your webserver and write cgi scripts, execute commands thro system("bdf") and store it in a file, display that..

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Please use plain text.
Acclaimed Contributor
Torsten.
Posts: 23,123
Registered: ‎10-02-2001
Message 3 of 7 (176 Views)

Re: shell scripting

You can do this using CGI programs/scripts.
See this link for more information:

http://httpd.apache.org/docs/2.0/howto/cgi.html

Hope this helps!
Regards
Torsten.

__________________________________________________

There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________

No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! star in the left column!   
Please use plain text.
Honored Contributor
Muthukumar_5
Posts: 4,030
Registered: ‎06-09-2004
Message 4 of 7 (176 Views)

Re: shell scripting

You have to develope a terminal emulator with perl+cgi scripts or| php scripting and put into apache web server.

On getting a command from user input, script will execute and send a result to command line.

hth.
Easy to suggest when don't know about the problem!
Please use plain text.
Esteemed Contributor
Vibhor Kumar Agarwal
Posts: 787
Registered: ‎04-05-2005
Message 5 of 7 (176 Views)

Re: shell scripting

Yes,

You will need a combination of telnet plus some scripting which will write the output to your browser.

CGI will be the best.
Vibhor Kumar Agarwal
Please use plain text.
Respected Contributor
Orhan Biyiklioglu
Posts: 153
Registered: ‎09-12-2005
Message 6 of 7 (176 Views)

Re: shell scripting

You can also do this using PHP on top of Apache. http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXWSAP4381

For example the following PHP script:

system("command");
?>

will execute the command on the server. However in such a case since this comand will be executed with the web servers user rights (unless you configure it to run as root). So, you will not be able to run root commands.

For a more complete solution for system administration try Webmin

hth

Please use plain text.
Advisor
Kryno Bosman
Posts: 12
Registered: ‎01-26-2004
Message 7 of 7 (176 Views)

Re: shell scripting

If you want to use a browser to run an UNIX-command and shows it output, you will need Perl or PHP on the server in combination with Apache. Check http://www.php.net for more information.
Simplicity is too difficult for idiots like you and me...
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