
UNSOLVED
SP
sudhansu-P0PMo
5 Posts
0
1437
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.
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.
Responses (5)
Solutions (0)
- 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 --filefile.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 youReply - 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);Reply 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 stdindatadmctl>
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 scriptthe script that needs to be run should be /action/ folder.
Hope this helps.
Thanks
Arun
Reply

Hemulll
2 Intern
•
138 Posts
399
0
Posted November 20th, 2008 00:00
I think you need only one file, but 2 different rules for different tasks.
Please explain what task do you want to solve .