Clarity

 View Only
  • 1.  Unrar command Linux with gelscript

    Posted Jul 12, 2016 12:13 PM

    Hi Guys!

     

    I need you help, please.

     

    I tried execute this command in gelscript:

     

    <core:set value="unrar x /tmp/DLP_11072016/PROP00006977/clarity/Files/918/005/DLP.rar" var="param"/>

    <core:catch var="IOExceptionUnrar">

      <core:invokeStatic className="java.lang.Runtime" method="getRuntime" var="getUnrar"/>

       <core:invoke method="exec" on="${getUnrar}" var="exeUnrar">

      <core:arg type="java.lang.String" value="${param}"/>

      </core:invoke>

      </core:catch>

     

    But, no success.

    There is no exception error and the file .rar is not extract on directory.

     

    Tests: "unrar x..." ,"unrar e ....".

     

    This command is executed successfully on Linux terminal.

     

    Successfully executed commands in gelscript:

     

    1)

    <core:catch var="IOExceptionRemov">

      <core:invokeStatic className="java.lang.Runtime" method="getRuntime" var="getRemov"/>

       <core:invoke method="exec" on="${getRemov}" var="exeRemov">

      <core:arg type="java.lang.String" value="rm ${renomArquivoNovo}"/>

      </core:invoke>

      </core:catch>

    2)

    <core:catch var="IOExceptionZip">

      <core:invokeStatic className="java.lang.Runtime" method="getRuntime" var="getZip"/>

       <core:invoke method="exec" on="${getZip}" var="exeZip">

      <core:arg type="java.lang.String" value="zip -r ${compactarNomeZip} ${compactarFolder}"/>

       </core:invoke>

      </core:catch>

     

    Obs.: Package installed on Linux: UNRAR 5.00 beta 3.

     

    Any ideas?

     

    Thanks!



  • 2.  Re: Unrar command Linux with gelscript

    Posted Jul 12, 2016 03:25 PM

    I would suspect that your Runtime has a different path then when you try it in a shell.

     

    Try changing the command text to include the absolute path to unrar.  So for example:

     

    <core:set value="/usr/bin/unrar x /tmp/DLP_11072016/PROP00006977/clarity/Files/918/005/DLP.rar" var="param"/>

     

    V/r,

    Gene



  • 3.  Re: Unrar command Linux with gelscript

    Posted Jul 13, 2016 09:06 AM

    Hi Gene!!!

     

    I tried "/usr/bin/unrar x" and "/usr/local/bin/unrar x", but not work yet. I dont understand.

     

    So, any idea?

     

    Thanks, Gene!

     

     



  • 4.  Re: Unrar command Linux with gelscript
    Best Answer

    Posted Jul 13, 2016 11:55 AM

    So to make sure you have the correct path run the which command in a shell.

    For example: where is gzip located using which.

     

     

    So run which unrar in a shell to get the correct path to the executable.

     

    V/r,

    Gene



  • 5.  Re: Unrar command Linux with gelscript

    Posted Jul 19, 2016 07:27 PM

    Gene Greiff escreveu:

     

    So to make sure you have the correct path run the which command in a shell.

    For example: where is gzip located using which.

     

     

    So run which unrar in a shell to get the correct path to the executable.

     

    V/r,

    Gene

    Hi Gene!!!

    Thank you very much!!

    Sorry, I'm busy!!

     

    Daniel Barros



  • 6.  Re: Unrar command Linux with gelscript

     
    Posted Jul 15, 2016 04:22 PM

    Hi danieldbf - Did gcubed's response help answer your question? If so please mark as Correct Answer. Thanks!



  • 7.  Re: Unrar command Linux with gelscript

    Posted Jul 12, 2016 03:31 PM

    I would also consider checking the exit code for the execute (which might required a waitFor())

     

    <gel:log>${getUnrar.exitValue()}</gel:log>

     

    V/r,

    Gene