Hi list,

for offering static files, there is the static@tntnet-component
available (which Im using really often ;-) ).
In tntnet.xml this is i.e. this config:

<mapping>
  <target>static@tntnet</target>
  <url>^/pm/(.*)$</url>
  <pathinfo>/opt/dmi/httproot/partedmagic/pmagic/$1</pathinfo>
</mapping>


Wouldnt it be practical to have some similar mechanism for execution
programs/scripts and give the result to the browser? I.e. i will give
the name "exec@tntnet" as component-name:


<mapping>
  <target>exec@tntnet</target>
  <url>^/exec/(.*)$</url>
  <pathinfo>/opt/dmi/scripts/$1.bash</pathinfo>
</mapping>


So if i offeer http://mytntnetserver.de/exec/givehostname

and in /opt/dmi/scripts ist the file givehostname.bash with

#!/bin/bash
echo $(hostname)


So I will able to use existing progs in a really simple way.
Furthermore, the use of parameters would be useful here, too:

<mapping>
  <target>exec@tntnet</target>
  <url>^/exec/add$</url>
  <parameters>summand1 summand2</parameters>
  <pathinfo>/opt/dmi/scripts/add.bash</pathinfo>
</mapping>

Now the appropriate add.bash script for the url
http://mytntnetserver.de/exec/add?summand1=45&summand2=77

#!/bin/bash
first_summand=$1
second_summand=$2
result=first_summand+second_summand
echo $result


I know, it is possible to use cxxtools::posix::CommandOutput for this,
but the other way looks much more compact and flexible. It is easy to
implement? Maybe already implemented but not used?

Tfh!
Oliver

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to