Definig variables at startup time

13 views
Skip to first unread message

John Sanabria

unread,
Apr 17, 2013, 7:55:17 PM4/17/13
to crash...@googlegroups.com
Hello,

CRaSH looks amazing and offers the functionality that I was looking for. Now, I have this situation, I need to define and initialize a Map List variable during the CRaSH start up time and use that same variable across different commands or groovy scripts (which must be defined in the cmd directory). Inquiries:
  1. Where is the proper place/file where this variable should be declared for once time? I don't care about persistence. That variable is initialized from data defined in a XML file, e.g. ~/hypervisors.xml
  2. This variable needs to be global for all CRaSH commands.

Thanks for your advice.

Julien Viet

unread,
Apr 18, 2013, 5:05:06 AM4/18/13
to crash...@googlegroups.com
Hi

the best place to do that is to do it in the special "login.groovy" file that is executed when a user login (conversely there is a logout.groovy  for logout):

All variable set will affect the user session : variable can contain anything:

Here is an example with JCR extension that uses it for storing closures that are reused in commands:


Julien

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes CRaSH User Group.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse crash-users...@googlegroups.com.
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .
 
 

john Sanabria

unread,
Apr 18, 2013, 11:22:12 AM4/18/13
to crash...@googlegroups.com
Excellent! it works :)
--
John Sanabria - Profesor de la EISC
Universidad del Valle
Reply all
Reply to author
Forward
0 new messages