Ein bisschen API, ein bisschen LS und schon läßt sich jeder Konsolenbefehl über LS an den Server absetzen.
Hier einmal beispielhaft, wie man die aktuelle Zeit des (Domino) Servers ermittelt.
(wurde hier nach gefragt : Datum-Zeit vom Server ermitteln
http://www.atnotes.de/cgi-bin/yabb/YaBB.pl?board=002-2;action=display;num=1016878077;start=1 )
' diesen code in die DELARATION section kopieren
Declare Function NSFRemoteConsole Lib "NNotes.dll" Alias "NSFRemoteConsole" (Byval Server As String, Byval cmd As String, ret As Long) As Long
Declare Function OSLockObject Lib "NNotes.dll" Alias "OSLockObject" (Byval Handle) As String
Declare Sub OSUnlockObject Lib "NNotes.dll" Alias "OSUnlockObject" (Byval Handle)
Declare Sub OSMemFree Lib "NNotes.dll" Alias "OSMemFree" (Byval Handle)
Class remoteConsole
Private IsError As Variant
Private rc As Integer
Private hBuffer As Long
Private Server As String
Private Command As String
Private Result As String
Sub New(inpServer As String)
Dim server As New NotesSession
If inpServer = "" Then
Me.IsError = True
Else
Me.server=inpServer
Me.IsError = False
End If
End Sub
Function Execute(inpCommand As String) As String
If Me.Server = "" Then
Exit Function
End If
If inpCommand = "" Then
Me.execute="You must specify a command"
Me.iserror = True
Exit Function
Else
Me.command = inpCommand
End If
Me.rc = NSFRemoteConsole(Me.server, Me.command, hBuffer)
If Me.rc <> 0 Then
Me.iserror = True
Me.result="Error returned " & _
" from console [" & Cstr(rc) & "]"
Else
Me.result = OSLockObject(hBuffer)
Call OSUnlockObject(hBuffer)
Call OSMemFree(hBuffer)
Me.Iserror = False
End If
Me.execute = Me.result
End Function
End Class
' Diesen code in einen button oder procedure kopieren
Sub Click(Source As Button)
Dim exec As String
Dim dummy As Variant
Dim remConsole As New RemoteConsole ( "comm1" ) ' hier den eigenen Server eintragen
Exec = "sh stat Stats.Time.Current" ' welche Konsolenkommando ??
If exec = "" Then
Exit Sub
Else
dummy = remConsole.Execute(exec) ' Kommandoo ausführen
Msgbox dummy ' Rückgabewert steht in dummy
End If
End Sub