I needed a way to see if an agent is running. To my knowledge, there’s no such thing possible with “normal” Notes-programming (is there such thing is normal programming in Notes?).
Collegue Jo Van Eynde (all credits go to him) came with the idea of sending a console command and capturing the output the console returns. Brilliant!
If the agent manager isn’t doing anything, it’s just idle, otherwise it returns something like Running agent ‘x’. Once you know that, it gets really simple.
Here’s the code:
Sub Click(Source As Button) Dim ConsoleReturn As String Dim StringToFind As String Dim AgentName As String Dim session As New NotesSession 'Specify the server to check ConsoleReturn = session.SendConsoleCommand("<Servername>","sh ta") 'Specify the agent to check AgentName="<AgentToCheck>" StringToFind="Running agent '"+AgentName+"'" Dim array1(0) As String Dim array2(0) As String Dim array3(0) As String Dim ret As Variant array1(0) =ConsoleReturn array2(0) = StringToFind array3(0) = "" ret = Replace(array1, array2, array3) If ret(0)<>consoleReturn Then Msgbox |Agent "|+agentName+|" RUNS!|,64,"Check Agent" Else Msgbox |Agent "|+agentName+|" DOESN'T run!|,64,"Check Agent" End If End Sub
The only thing I don’t check in my code, is the database name, so you if your agents have the same name across different databases, it might be another agent in another database that is running (instead of the one you wanted to check).