Subject: Domino Server runs multiple compact tasks on a Tuesday at 12 midday - A FIX THAT WORKS!!
By jove I think I’ve fixed it!!The problem wasn’t local policy documents, but the problem was in the local names and address book - Program documents found in ($Programs).
It seems that each time a policy document is applied to the client, an associated program document is created, and these do not get cleared down. To overcome this, you can visit each client, open the local name and address book, hold down Shift+Ctrl whilst opening the “View\GoTo” option, and select view ($Programs), then delete all documents that run at 12:00 on a tuesday (3). Alternatively, copy the following code into the PostOpen event of the Database Script of your EMail template (Mail6.ntf - open in design, goto Other\Databaes Resource), then after the 1am designer task runs, the code will be present in each mail file to be run by each client on open. Read the header detail for more info on the code.
The code will EMail notification of what it’s done. Some of my users had upwards of 91 program documents, hence the proliferation of compact tasks on a Tuesday midday. Who’s responsible for QAing this product!!
Good luck
%REM Mike Hayman - mhayman@bpms.co.uk - 7th April 2004
CODE FOR LOCAL PROGRAM DOCUMENT CLEAR DOWN
This code finds and removes and Program documents from the local Address Book that initiate a compact task at noon on a Tuesday
When a policy is applied to a user, and that policy has a local archive requirement, a program document is created in the local directory.
These program documents are not always cleared down when the policies are changed.
You can see the programs defined locally in view ($Programs) in the local Address Book
This code can be put into the PostOpen event of Database Script in a user database such as the Mail database.
It can be removed after a period (say a month) as it only needs to be run once per user.
This code will only run once; controlled by a flag in a profile document within the local Address Book
Set constant c_bNotify to true to send an email to name in constant c_sSendTo
Email notification states the number of program documents deleted.
If Notify flag set, then will also send notification of any errors encountered.
Set constant bRunForAllUsers to false in order to control the users that run the code by specifying them in arrsUser
%END REM
Const c_bNotify = True
Const c_bRunForAllUsers = False
Const c_sSelect = { Type ="Program" & Form = "Program" & Program = "Compact" & Schedule=[12:00:00] & WeekDays = "3" }
Const c_sSendTo = "Administrators"
Const c_sProfileName = "DatabaseProfile"
Const c_sProfileItem = "ProgramRemovedDate"
Dim arrsUser () As String
Dim sess As New NotesSession
Dim docProfile As NotesDocument
Dim docMail As NotesDocument
Dim sUserName As String
Dim vAddressBooks As Variant
Dim dbAddressBook As NotesDatabase
Dim dcProgram As NotesDocumentCollection
Dim iProgram As Integer
Dim sErrorMessage As String
On Error Goto ErrorHandle
' Only run for specific users
If Not c_bRunForAllUsers Then
Redim arrsUser (0 To 5)
arrsUser(0) = "User1"
arrsUser(1) = "User2"
arrsUser(2) = "User3"
arrsUser(3) = "User4"
arrsUser(4) = "User5"
arrsUser(5) = "User6"
sUserName = sess.CommonUserName
If Isnull ( Arraygetindex ( arrsUser, sUserName)) Then Exit Sub
End If ' Do not run for all users
' Get local address book
vAddressBooks = sess.AddressBooks
Forall f_Db In vAddressBooks
If f_Db.IsPrivateAddressBook Then
Set dbAddressBook = f_Db
Exit Forall
End If
End Forall
If Not dbAddressBook Is Nothing Then
If Not dbAddressBook.IsOpen Then dbAddressBook.Open "", ""
' Check that have not run before
Set docProfile = dbAddressBook.GetProfileDocument ( c_sProfileName )
If Not docProfile.HasItem ( c_sProfileItem ) Then
' Run selection
Set dcProgram = dbAddressBook.Search (c_sSelect , Nothing, 0)
If dcProgram.Count > 0 Then
Print "Removing " + Cstr ( dcProgram.Count ) + " Program documents..."
iProgram = dcProgram.Count
dcProgram.RemoveAll True
If c_bNotify Then
Print "Sending notification of deletion of " + Cstr (iProgram) + " program documents to " + c_sSendTo + "..."
Set docMail = dbAddressBook.CreateDocument
docMail.Subject = "PAB - " + sUserName + ": " + Cstr ( iProgram ) + " Program documents deleted"
docMail.Send False, c_sSendTo
End If ' Notify administrator
End If ' There are archive policy documents
docProfile.ReplaceItemValue c_sProfileItem, Now()
docProfile.Save True, False, True
End If ' Have not run before
End If ' Address book found
Goto EndOfSub
ErrorHandle:
sErrorMessage = |** Error | + Cstr (Err) + |: "| + Error$ + |" raised at line | + Cstr (Erl) + | when removing Program Documents for | + sUserName
If c_bNotify Then
Print "Sending notification to " + c_sSendTo + ". " + sErrorMessage
Set docMail = dbAddressBook.CreateDocument
docMail.Subject = "PAB - " + sUserName + ": " + sErrorMessage
docMail.Send False, c_sSendTo
Else
Print sErrorMessage
End If ' Notify administrator
Resume EndOfSub
EndOfSub:
%REM Mike Hayman - mhayman@bpms.co.uk - 7th April 2004
CODE FOR LOCAL PROGRAM DOCUMENT CLEAR DOWN
%END REM