Start a Conversation

Unsolved

This post is more than 5 years old

1386

September 9th, 2008 04:00

Call a ASL script from another ASL script

Hi,

Can anyone tell me, how I can call and execute a ASL script from another ASL script, passing a input file to the second ASL script... Please suggest some solution..

For eg, executing test2.asl called from test1.asl, passing an input file named list1.txt to be used in test2.asl.

2 Intern

 • 

138 Posts

November 20th, 2008 00:00

Hi.

I think you need only one file, but 2 different rules for different tasks.

Please explain what task do you want to solve .

89 Posts

November 20th, 2008 01:00

Hi,

IN which context are u executing this?
Wouldn't be easier using perl?
I know a script might be called from another script, but never used parameters.

cheers

F,

2 Intern

 • 

138 Posts

November 20th, 2008 04:00

Hi

You can use perl.

Example for simple perl script

use InCharge::session;


# -- Global variables
$domain = "INCHARGE-SA-TEST";
$class = "Host";

# -- Create session
$session = InCharge::session->new(
broker=>"127.0.0.1",
domain=>$domain,
username=>"admin",
password=>"changeme",
traceServer => 1
);
$observer = $session->observer();
# -- Get instances from class Host
foreach $inst (sort $session->getInstances($class)) {
print $class . "::" . $inst . "\n";

# -- Create the object for each instance
$obj = $session->object($inst);

# -- continue with next element if object is no defined
next if ($obj->isNull());
# -- put your code here



2) you can use asl file with sm_adapter --file file.asl


But needs to completely to understand your task, for create script.

Let me know what do you want to do in your script and i will try to help you

53 Posts

December 26th, 2008 16:00

To communicate between different ASL scripts you will either need to create a GA_Driver or ACT_Script type object.

For ASL to ASL functionality the GA_Driver and similar classes are the preferred way, they also allow for 2-way communication between the scripts.

Here is an example from the ic-topomanager.asl

driver = create("GA_Driver", "Seed-Verify-Driver");
fe = create("GA_FileFE", "Seed-Verify-FE");
fe->fileName = SEED_FILE;
driver->ReadsInputFrom = fe;
rule = create("GA_RuleSet", "Seed-Verify-RS");
rule->fileName = "discovery/ic-file-importer.asl";
driver->ReadsRulesFrom = rule;
localServer = create("GA_LocalServer", "Seed-Verify-BE");
if (localServer->isNull()) {
localServer = create("GA_NullServer", "Seed-Verify-BE");
}
driver->SendsActionsTo = localServer;

paramObj = driver->getMyParameters();
verify = "FALSE";
if (SEED_VERIFY) {
verify = "TRUE";
}
paramObj->insert("SEED_VERIFY", verify);
driver->startWithParameters(paramObj);

37 Posts

January 27th, 2010 02:00

ACT_Script is a class which can be used for this purpose.

dmctl> getProperties ACT_Script

Properties of class ACT_Script:
      CreationClassName =
                   Name =
            ServiceName =
    interpreterFilespec =
        interpreterPath =
        scriptDirectory =
             scriptName =
                   test =
                  trace =

dmctl> getO ACT_Script

Operations for class ACT_Script:
    clone_name
    run parameters stdindata
    run_ex parameters stdindata

dmctl>

sample snippet

------------------------------

sampleScript = create("ACT_Script", "SAMPLE-SCRIPT" );

sampleScript->scriptName = "getDetails_From_AM.sh";
systemUptime = sampleScript->run(firewallObj->Name);ACT_Script is a class which can be used for calling an external script

the script that needs to be run should be /action/ folder.

Hope this helps.

Thanks

Arun

No Events found!

Top