ShowTable of Contents
Introduction
The TDP backup automation process consists of two steps:
(1) Creating a batch file that queries the TDP log files, copies the logs that have today’s date, and exports them to your IBM Notes® client workstation.
(2) Compiling a LotusScript routine that picks the exported files and mails them to the intended recipients.
Before beginning, however, go to the server and map one of your workstation's (where your Lotus Notes client is installed) drives, via Map Network Drive, setting the drive name as Y:\
Creating a batch file
There are two date formats with which we create a batch file.
The first when the date format of the TDP.log file is MM/DD/YYYY. Normally, first the logs are generated, followed by the date and time. However, figure 1 shows the case in which logs are generated with the date and time stamp at the start. The date format is MM/DD/YYYY.
Figure 1. Log samples with MM/DD/YYYY date format
Now, copy the script in listing 1 into the notepad and create a batch file. Make sure the syntax of the find command is
find "%date:~-7,2%/%date:~0,2%/%date:~-4,4%" as the date format is MM/DD/YYYY.
Listing 1. Script for MM/DD/YYYY-format batch file
@ECHO OFF
REM Setup of TSM Directory
set share_dir="C:\Program Files\Tivoli\TSM\Domino"
cd %share_dir%
REM Add current date and time to log
Echo. Y:\AutomatedTDPDaily.log
Echo ----------------------------------------- Y:\AutomatedTDPDailyservername.log
Echo Started checking Daily Backup logs on GBAPPS01 Server. Y:\AutomatedTDPDaily.log
Echo Current date is : Y:\AutomatedTDPDaily.log
Date /t Y:\AutomatedTDPDaily.log
Echo Current time is : Y:\AutomatedTDPDaily.log
Time /t Y:\AutomatedTDPDaily.log
type domdsm.log C:\domdsm.log
find "%date:~-7,2%/%date:~0,2%/%date:~-4,4%" C:\domdsm.txt Y:\AutomatedTDPDaily.log
Echo ----------------------------------------- Y:\AutomatedTDPDaily.log
Echo Current date is: Y:\AutomatedTDPDaily.log
Date /t Y:\AutomatedTDPDaily.log
Echo Current time is: Y:\AutomatedTDPDaily.log
Time /t Y:\AutomatedTDPDaily.log
Echo Completed Checking Daily Backup logs on GBAPPS01 server. Y:\AutomatedTDPDaily.log
Echo ----------------------------------------- Y:\AutomatedTDPDaily.log
Make sure the path name for the TDP.log is stated correctly in setshare_dir.
The second case is when the date format is DD/MM/YYYY. Figure 2 shows an example of the date in DD/MM/YYYY format. In this case, make sure the syntax of the find command is
find "%date:~0,2%/%date:~-7,2%/%
Figure 2. Log samples with DD/MM/YYYY date format
Now copy the script in listing 2 into Notepad and create a batch file, making sure the path name for the TDP.log is stated correctly in setshare_dir. The batch file should run on the system account and should be added on the scheduled task of the server.
Listing 2. Script for DD/MM/YYYY-format batch file
@ECHO OFF
REM Setup of TSM Directory
set share_dir="C:\Program Files\Tivoli\TSM\Domino"
cd %share_dir%
REM Add current date and time to log
Echo. Y:\AutomatedTDPDaily.log
Echo ----------------------------------------- Y:\AutomatedTDPDailyservername.log
Echo Started checking Daily Backup logs on GBAPPS01 Server. Y:\AutomatedTDPDaily.log
Echo Current date is : Y:\AutomatedTDPDaily.log
Date /t Y:\AutomatedTDPDaily.log
Echo Current time is : Y:\AutomatedTDPDaily.log
Time /t Y:\AutomatedTDPDaily.log
type domdsm.log C:\domdsm.log
find "%date:~0,2%/%date:~-7,2%/%date:~-4,4%"
Y:\AutomatedTDPDaily.log
Echo ----------------------------------------- Y:\AutomatedTDPDaily.log
Echo Current date is: Y:\AutomatedTDPDaily.log
Date /t Y:\AutomatedTDPDaily.log
Echo Current time is: Y:\AutomatedTDPDaily.log
Time /t Y:\AutomatedTDPDaily.log
Echo Completed Checking Daily Backup logs on GBAPPS01 server. Y:\AutomatedTDPDaily.log
Echo ----------------------------------------- Y:\AutomatedTDPDaily.log
Compiling the LotusScript routine that sends automated emails
Once the batch file has exported today’s log from TDP.log to the shared network drive (Citrix), you then need to compile the LotusScript that will pick today’s log and forward it to the intended recipients. To do this:
- Open your mail file in Domino Designer and select Shared Code and Agents.
- Select New Agent, set the title as AutoMail, and the select the Runtime Target as NONE.
- Choose the mode of the agent as Lotus Script and in the initialize section, copy the code in listing 3 and paste it in.
Listing 3. LotusScript code for automated emails
Sub Initialize
Dim Notes As New NotesSession
Dim DB As NotesDatabase
Dim EmbObj As NotesEmbeddedObject
Dim maildoc As NotesDocument
Dim body As NotesRichTextItem
'Dim EmbObj As NotesEmbeddedObjec
Dim Recipients (1 To 2 ) As String
recipients (1) = "Shankar Venkatachalam/India/IBM"
recipients (2) = " Shankar Venkatachalam/IBM/GIS/ICI "
recipients (3) = "X"
recipients (4) = "Y"
recipients (5) = "Z"
Set DB=Notes.CurrentDatabase
Set maildoc=db.CreateDocument
Set body=New NotesRichTextItem(maildoc,"Body")
maildoc.Form="memo"
maildoc.Subject = "GBWANM06 Automated Daily Backup logs"
'maildoc.SendTo="Shankar Venkatachalam/IBM/GIS/ICI"
'maildoc.SendTo="GIS ICI EMEA Spirit Lotus Notes Support/IBM/GIS/ICI";"Shankar Venkatachalam/IBM/GIS/ICI"
Set EmbObj=body.EmbedObject(EMBED_ATTACHMENT," ", "E:\AutomatedTDP logs\GBWANM06AutomatedTDPDaily.log")
Call maildoc.Send (True, Recipients)
End Sub
You can add “n” number of recipients by adding recipient 6, recipient 7, and so on. Be sure to select the path to where you have exported today’s log.
Conclusion
By following the steps outlined in this article, you can automate the manual task of checking TDP backup logs on the server, which can save a considerable amount of time in your routine administration work.
Resources
Lotus Domino and Notes information center:
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp
Notes and Domino wiki article, “Restoring IBM Lotus Domino data from a decommissioned Domino server”:
http://www-10.lotus.com/ldd/dominowiki.nsf/dx/Restoring_IBM_Lotus_Domino_data_from_a_decommissioned_Domino_server
developerWorks Lotus Notes and Domino product page:
http://www.ibm.com/developerworks/lotus/products/notesdomino/
Lotus Notes/Domino 8.5 Forum:
http://www-10.lotus.com/ldd/nd85forum.nsf
About the author
Shankar Venkatachalam is an IBM Software Engineer based at IBM's Pune, India, facility. He works on the Domino Crash, Core, and Performance Analysis Support team and is an IBM Certified Administrator for Lotus Domino. With his knowledge of LotusScript, he has developed additional automations for Lotus Administration tasks including (1) a single Domino database that purges dead mail from all servers in a domain, (2) a database to create mail-in databases at the backend, and (3) a tool/database that sends a Welcome message for all newly registered users in a domain. You can reach Shankar at
svenkat7@in.ibm.com.