Clarity

 View Only
  • 1.  How do i call shell script from gel script any ideas

    Posted Sep 21, 2021 03:51 PM
    Hi Team,

    I would like call shell script from Gel Script.
    Does Any one have any idea on how to achieve this.

    Thanks in Advance

    Thanks


  • 2.  RE: How do i call shell script from gel script any ideas

    Posted Sep 22, 2021 09:34 AM
    Hi Shanti,

    You can run a shell script from Java (https://www.baeldung.com/run-shell-command-in-java), so it will be possible to run it from GEL with a bit of trial and error. I haven't tried this specific task myself, but there are two options. The first is to use the <core:new> and <core:invoke> tags to call the specific Java class/method mentioned in the link and supply the parameters you need. A second way is to code your own tag and include it in the custom folder, then include it in the list of tag libraries at the start of the script. You can then use that tag in your script and include any tag attributes in the same way as any other tag.

    I used the second method way back in 2008 at a client to extract only the bits of an XML file I wanted and deliver these as a document in memory, so I know it's possible.


  • 3.  RE: How do i call shell script from gel script any ideas

    Posted Sep 22, 2021 12:38 PM
    Something similar...

    <core:invokeStatic className="java.lang.Runtime" method="getRuntime" var="javaRuntime"/>
    <core:invoke method="exec" on="${javaRuntime}" var="execCommand">
    <core:arg type="java.lang.String" value="touch /tmp/test"/>
    </core:invoke>​