Skip to Content.
Sympa Menu

grouper-users - Re: [grouper-users] GSH (new groovy based) ... passing in command line parameters?

Subject: Grouper Users - Open Discussion List

List archive

Re: [grouper-users] GSH (new groovy based) ... passing in command line parameters?


Chronological Thread 
  • From: Shilen Patel <>
  • To: "Black, Carey M." <>, "" <>
  • Subject: Re: [grouper-users] GSH (new groovy based) ... passing in command line parameters?
  • Date: Wed, 2 May 2018 09:43:59 +0000
  • Accept-language: en-US
  • Authentication-results: oit.duke.edu; spf=none
  • Ironport-phdr: 9a23:4ijO4hxdihChdojXCy+O+j09IxM/srCxBDY+r6Qd2+IeIJqq85mqBkHD//Il1AaPAd2Araocw8Pt8InYEVQa5piAtH1QOLdtbDQizfssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1JuPoEYLOksi7ze+/94HdbglSmDaxfa55IQmrownWqsQYm5ZpJLwryhvOrHtIeuBWyn1tKFmOgRvy5dq+8YB6/ShItP0v68BPUaPhf6QlVrNYFygpM3o05MLwqxbOSxaE62YGXWUXlhpIBBXF7A3/U5zsvCb2qvZx1S+HNsDtU7s6RSqt4LtqSB/wiScIKTg58H3MisdtiK5XuQ+tqwBjz4LRZoyeKfhwcb7Hfd4CRWRPQNtfVzBPDI2/YYQPDvYOMulDoobnu1cOqAGzCRW2Ce7tzDJDm3/43bc90+QkCQzIwQwgH9MKsHvKqtX+Kb0cXvqpzKbWyTXIcvRb2Sz96IjJdhAuv/eMUKltfsrMykkgCRnJgUuNpoz4Jj6Y0PkGvWuD7+d4SO6ii3Arpxt/rzS128shiY3EipgLxl3L+ih12Js5KNO5RUJhYdOpEYFcuiKAO4Z2QM4uW29otzg5x7EavJO2eTQFx4o5yxPab/GKcIaI7QnmWeuVLjp0mXZodbe8ihu89UWv0OvxXdSu3llQtCpKiNzMu2gN1xPN7siHTeNw/kK71jaO0wDf8+5EIE4tmabGKJMt2LkwlpsPsUjZAyD2hUb2g7GMeko65+eo9vzrYrTgppCCK495khzyP6QwlsClD+k0KBUCUmuf9OimyrHu8kL0TK1PjvIsk6nZtJ7aJd4cpq68GwJVyYYj6xe7Dzi41tQVhmQILE9GeB2ZlYTmJUzBIO3gAfeln1usiCtrx+zBPrD5DZXNNH/DkKr5fblj8U5Q0RczzctB6JJOEbEMO/bzWk7qtNzEFR81LRa4w+fhCNVhyIweQ2SPDbGFMK/Mq1OH+P8gI/TfLLMS7XzXL/Eu5LqmpnYjlE5VWO/jlc8dbHmzHbI/eR6xZmHxxNoNDDFO9kAxVuv3kFCYFCNIamypd6M6+jwhDo+6V8HOSp3nyOiOxiCmBpBMI31dB0qXOXbua4ieXfoQMmSfLtI3wRIeUr30cI8g0Ryo/Dfz17djZr7P+iwcuJTL2MV26qvemQxkpm88NNiUz2zYFzI8pWgPXTJjmfkn+UE=
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

Hi,

 

GSH_JVMARGS is for system properties so that should work.

 

e.g.

 

export GSH_JVMARGS="-Dx=something"

 

 

Then your script has:

 

System.out.println("x="+System.getProperty("x"))

 

For runarg to work, I think gsh.sh has an issue.  Can you see if this change makes it behave correctly for you?

 

-       ${JAVA} -Xms$MEM_START -Xmx$MEM_MAX -Dgrouper.home="$GROUPER_HOME/" -Dfile.encoding=utf-8 $GSH_JVMARGS -classpath "${GROUPER_CP}" $GSH $*

+       ${JAVA} -Xms$MEM_START -Xmx$MEM_MAX -Dgrouper.home="$GROUPER_HOME/" -Dfile.encoding=utf-8 $GSH_JVMARGS -classpath "${GROUPER_CP}" $GSH "$@"

 

 

Thanks!

 

- Shilen

 

On 5/1/18, 11:30 PM, " on behalf of Black, Carey M." < on behalf of > wrote:

 

    All,

   

    I have started to write a few GSH scripts and I am not clear on how I can pass in a "command line parameter" to the script.

                Specifically I am looking for "configuration variables" that would drive what the script does for this run.

   

    Should I look at using JVM properties?

                ./gsh appears to have a place holder for GSH_JVMARGS, but nothing setting it in that script... is that the best way (only way?) to do this task?

   

    

    I did look at GrouperShellWrapper and GrouperShell... which gave me some hope... but this did not work out... and it is not clear to me why it did not work...

   

    REF: ( a simple one line script I was trying to test with)   testCLI.gsh

     System.out.println('x='+x)

   

    Command line:

    ./gsh.sh -runarg 'x=3\n:load testCLI.gsh\n'

    OR

    ./gsh.sh -runarg '"x=3\n:load testCLI.gsh\n"'

   

    Produced:

    "

    groovy:000> :load /...../conf/groovysh.profile

    groovy:000> "x=3

    groovy:001> :load

    Command ':load' requires at least one argument

    groovy:001> :exit

    "

                I am really not clear why the testCLI.gsh part of the runarg string did not make it. (???)

   

    

    Any clue-bricks out there?

    

    --

    Carey Matthew

   

    

    




Archive powered by MHonArc 2.6.19.

Top of Page