We are trying to implement a backup program and need to run a nightly check to see which databases (if any) are still open.
Is there any way to schedule this check and write the results to a text or log file?
Thanks,
-MC
We are trying to implement a backup program and need to run a nightly check to see which databases (if any) are still open.
Is there any way to schedule this check and write the results to a text or log file?
Thanks,
-MC
Subject: Nightly log of databases still open at 12AM?
The console command DBCACHE SHOW will list open databases.
You can use a LotusScript agent to do this command and parse the results. I have just such code (below). Comments: You should hard code the server name or user current server. There are several different ways you could handle errors, depending on the context. The agent (and user) must be allowed to use restricted OS commands. You don’t need the .Send() unless you want to.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim targetServer As String
Dim curServer As String
Dim result As String
Dim MailDoc As NotesDocument
Dim curName As NotesName
Dim passMsg As String
Const lsERR_NOTES_ERROR = 4000
passMsg$ = ""
On Error Goto GeneralErr
On Error 4000 Goto ConnectFailed
Set db = session.CurrentDatabase
Set curName = session.CreateName( db.Server )
curServer$ = curName.Abbreviated
targetServer$ = "serverX" ' --- let one server check another
result$ = StrRight( session.SendConsoleCommand( targetServer$, "Show Tasks" ), "HTTP" )
If result$ = "" Then
Goto SendMail
Else
Print "The HTTP task is running on " & targetServer$ _
& " " & session.CurrentAgent.Name
End If
End
GeneralErr: ’ agent just died
passMsg$ = session.CurrentAgent.Name & " An Error: " & Error$ & " (" & Cstr(Err) _
& ") has occurred on line: " & Cstr(Erl) & " in procedure " & Getthreadinfo(1) _
& " general-error"
Msgbox passMsg$
Goto SendMail
End
ConnectFailed: ’ for some reason or another, this server could not connect the other server
passMsg$ = session.CurrentAgent.Name & " An Error: " & Error$ _
& " has occurred on line: " & Cstr(Erl) & " in procedure " & Getthreadinfo(1) _
& " connect-failed"
Msgbox passMsg$
Goto SendMail
End
SendMail:
Set MailDoc = New NotesDocument( db )
MailDoc.Form = "Memo"
MailDoc.SendTo = ...
MailDoc.Principal = "Domino " & curServer$
MailDoc.Subject = "Server NOT running HTTP: " & targetServer$
MailDoc.Body = passMsg$ & Chr(10) _
& "According to " & curServer$ _
& " the HTTP task does not appear to be running running on " & targetServer$ & Chr(10) _
& " " & session.CurrentAgent.Name
Call Maildoc.Send( False )
End
End Sub