Schedule Agent to Run on Mailboxes and Split the Amount it Runs on

I have an agent that deletes mail older than 90 days, but we have over 500 mailboxes and I don’t want to load the server. How can I tell the agent to run on A-E mailboxes on one day and F-K…etc. the next and so on?

Thanks in advance.

Subject: Schedule Agent to Run on Mailboxes and Split the Amount it Runs on.

User,

Many different approaches. The approach I prefer is to have the agent frequently check how long it’s been running and stop after n minutes, where n is 20% less than your max time allowed for agents.

Then let it run every night.

For the first bunch of nights, it’ll go slowly, as it churns through fat db’s. But once it’s been through them all, it’ll zip through as it maintains them to the appropriate level.

regards,

raphael

Subject: Schedule Agent to Run on Mailboxes and Split the Amount it Runs on.

Either do it on two separate agents and schedule them separately, or put a hook in the code that checks to see whether the day is even or odd and on even have it do A-M and odd have it do N-Z. Either way you have to put code in that discriminates as two which alphabetical grouping in which they should fall. Just do a check on the first letter of the last name, e.g.:

If ucase(right$(doc.LastName,1))=“N” then…

On the N-Z days you can even start in the "N"s by doing a lookup on the People view and with a key of “N” and setting the ‘exact’ bit to ‘false’:

Set doc=view.GetDocumentByKey(“N”,False)

Subject: RE: Schedule Agent to Run on Mailboxes and Split the Amount it Runs on.

So something like this? Not sure how I would set N-Z though, this looks like it’s just scanning just N

Dim s As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim c As notesDocumentCollection

Dim view As NotesView

Dim result As Variant

Dim expr As String

If ucase(right$(doc.LastName,1))=“N” then

Set db = s.currentDatabase

Set view = db.GetView("To Be Deleted")



expr = {@Created < @Adjust(@Today;0;0;-90;0;0;0)}

Set doc = view.GetFirstDocument

Do Until doc Is Nothing

	If doc.form(0) = "Memo" Or doc.form(0) = "Reply" Then 

		result = Evaluate(expr, doc)

		If result(0) Then

			Call doc.ReplaceItemValue("DeleteMe", "1")

			Call doc.save(True, True)

		End If

	End If

	Set doc = view.GetNextDocument(doc)

Loop



expr = {DeleteMe = "1"}

Set c = db.Search(expr, Nothing, 0)

’ Call c.RemoveAll(True)

End If