Alerts running programs

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Alerts running programs

  • Creator
    Topic
  • #47973
    Rick Martin
    Participant

      Hi,

      I’m trying to get a home-grown program (exe) to run as part of an alert, but it doesn’t run.  I have the Action set to:

      exec {c:\dir\pgm.exe “parm1” “parm2” “parm3”}

      But the program never appears to run.  There is also a notify {} action ahead of this one, so I know the alert fires.

      Do I have my syntax wrong?

      Thanks! Rick

    Viewing 2 reply threads
    • Author
      Replies
      • #57207
        Doug Stelley
        Participant

          I Use:

          Exec {cmd /c  c:\hci\affinitycrash.vbs}

          and it works…

        • #57208
          Tom Henderson
          Participant

            The exec command requires a list, and you’re giving it what amounts to a string.  So it’s trying to find and run a program named c:\dir\pgm.exe “parm1” “parm2” “parm3”, when you want it to run a program named c:\dir\pgm.exe and pass in the parameters parm1, parm2, and parm3.

            The other wrinkle is that it the list needs to be flattened, that is, at the same level as the exec command, not just contained in a variable.  Otherwise, your program will see a single parameter rather than three separate parameters.

            Fortunately, the fix is easy.  The eval command will not only run any other TCL command, but also flatten out the list structure for you.   Just issue the command like this:

            eval exec c:\dir\pgm.exe “parm1” “parm2” “parm3”

            Essentially, any time you want to construct a command programmatically, then execute it, just use the eval exec combo.

            BTW, I generally find it easier to use single forward slashes rather than double the backslash.  Of course, if you’re passing a pathname to a native DOS/Windows command, you may not have any choice…

          • #57209
            Rick Martin
            Participant

              Thanks all.  Turns out it was a permissions problem.  The hciuser didn’t have the right permissions to run the program.

              Next question.  I see in the user guide (in an example) that I can use a %A for the message text.  Is there a similar way to get the host and site information?

              Thanks, Rick

          Viewing 2 reply threads
          • The forum ‘Cloverleaf’ is closed to new topics and replies.