akher
akher

Reputation: 1

How to run a command line in HTML using javascript?

First of all, I have nearly zero experience with HTML and java, so a simple answer will be appreciated!

I'm working on a WSN project using a telosb mote running TinyOS and Xubuntu, what I have to do is set up a web server that can communicate with my mote, and the only way I know of doing this is with command lines, using "java net.tinyos.tools.Send X" where X is my input from my web server.

So on my web server, have a form where i can input a number to send to my mote, and when submitting the number a function runs the command java net.tinyos.tools.Send X.

Is this possible?

I have read previous answered questions but please note that I know nothing about java as I work with electronics, so I pray for answers that a beginner like me will understand. Thank you very much!

Upvotes: 0

Views: 1398

Answers (1)

Casper
Casper

Reputation: 11

Yes you can run system commands using a web server. Simply send the value from browser to your server. And when the server receives the value you can execute the desired system command.

For example, If your server is in python (e.g. Flask), look for os.system in python os module. https://docs.python.org/3/library/os.html

if your server is in nodejs (e.g. Express) look for child_process.exec in child_process module to run system commands. https://nodejs.org/api/child_process.html

Upvotes: 0

Related Questions