UNSOLVED

stoechi

updated

17 years ago

S

stoechi

7 Posts

0

4918

March 27th, 2009 07:00

invoke perl script using script notifier adapter

Hey guys, guess this is too lame for the developer section, but i've tried so long unsuccessfully to invoke a simple perl script via sm_notify. Btw, the mail notifier adapter i got even working,  makes me think i'm not too stupid ;o) to understand. I did the following:

wrote a simple perl script "test.pl":

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

#!/usr/bin/perl

foreach (@ARGV) {
  print "$_\n";
}

$file = 'file.txt';
$text = "just a text";

open(HANDLE, ">file.txt") or die("$!\n");
print HANDLE $text;

close(HANDLE);

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

which is located in /opt/InCharge72/SAM/smarts/local/actions with full permissions (also the directory is granted writing permissions)

Then changed the config files:

/opt/InCharge72/SAM/smarts/local/conf/notifier/script-notify.conf:

    serverName = "OURSERVER"

    scriptName = "test.pl"

/opt/InCharge72/SAM/smarts/local/rules/notifier/script/script-filter.asl (kept default)

/opt/InCharge72/SAM/smarts/local/rules/notifier/script/script-custom.asl (kept default)

Now i start the Notifier Adapter via:

[root@smarts1 bin]# ./sm_notify --output --confdir=/opt/InCharge72/SAM/smarts/local/conf/notifier/ --conf=script-notify.conf script

The little server remains running, the log file only shows:

InCharge Server OURSERVER has connected.

However, it looks like the script was not invoked because the file.txt was not created (which is the task of the script) and the output (print HANDLE $text; ) - i dont even know in which terminal to expect it :l

If this would work, the documentation anyway lacks about passing the arguments.. If someone could help me, it would be great, as you can see i am a beginner. I thought about trying to get deeper in ASL, but i guess it shouldnt be necessary for that?!

Thx, Stephan