LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-20-2011, 11:41 AM   #1
orcusomega
LQ Newbie
 
Registered: Dec 2011
Posts: 2

Rep: Reputation: Disabled
Executing shell command from JSP file with command line arg from URL


I have a home automation application that runs on Tomcat, and I am looking to extend the capabilities... Problem is I am not a programmer...

I am looking for a JSP script that will run a command line and use 2 values from the URL to define the action.

Example: The X10 SDK provides an executable (ahp.exe) that takes 2 command line options: device and status. The executable then sends the command to the device attached via USB. If I were trying to turn the device A10 to on, the command I would run at the command line would be "ahp.exe A10 ON".

So - long story short, I am looking to be able to go to a URL like this: localhost:8080/my.jsp?device=A10&status=ON and have that JSP run the command in the background. I don't care about getting feedback, I assume Tomcat will complain in its own logs if there is an issue.

Any help is appreciated - I have searched here and elsewhere, I suppose I am not looking up the right search strings....

Thanks!

Bob
 
Old 01-13-2012, 10:29 AM   #2
hyperdaz
Member
 
Registered: Sep 2004
Location: UK
Distribution: CentOS 5.5
Posts: 44

Rep: Reputation: 1
Shame your not running Linux and Bash... can do the very thing your asking for with cgi-scripts - I used it to stop - start and restart JBoss for humans.

Seems you are on Windows (ahp.exe) no clue if the same is possible, never tried.


http://www.linuxaria.com/article/bash-cgi?lang=en

Last edited by hyperdaz; 01-13-2012 at 10:31 AM.
 
Old 01-13-2012, 03:38 PM   #3
orcusomega
LQ Newbie
 
Registered: Dec 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hyperdaz View Post
Shame your not running Linux and Bash... can do the very thing your asking for with cgi-scripts - I used it to stop - start and restart JBoss for humans.

Seems you are on Windows (ahp.exe) no clue if the same is possible, never tried.


http://www.linuxaria.com/article/bash-cgi?lang=en
Yes... It is a small system that has very little memory - one of the applications uses a Tomcat instance that I could potentially use to run command line commands through JSP. I could install apache and php, and that would work too - but i am trying to take advantage of what is already installed.

Thanks!

Bob
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
running shell scripts by taking command line arguments in a jsp page msoumyajit Linux - Server 1 12-21-2011 06:41 AM
[SOLVED] ? running shell script taking command line arguments in a jsp page? etika Linux - Newbie 1 02-11-2011 01:26 AM
Executing Shell Command in JSP Jerry Mcguire Programming 6 08-30-2010 09:37 PM
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 11:21 AM
PostgreSQL: executing a .SQL file from command line? J_Szucs Linux - Software 0 09-24-2003 11:49 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration