Do you want to create backup copies of your files on your workstation, without having a professional file backup application? Are you finding that you rarely create backups because of the tedious nature of doing it manually? Have you, at the end of every day, tried to identify which files you've worked on throughout the day so you can create backup copies? I know I have. But not anymore.
11.01.2003 Lotus Advisor, Nov/Des 2002
Vidar Kongsli, Seniorkonsulent, Bekk Consulting
In this article, I introduce you to the basic steps of creating a lightweight yet efficient file backup solution using nothing but a Lotus Notes R5 client installed on a Microsoft Windows 2000 workstation. I use a Lotus Notes database as a repository for file backup copies. By leveraging the company's existing Lotus Domino infrastructure, I show how Lotus Notes makes this a flexible solution with respect to network infrastructure. Furthermore, this isn't only a backup solution, but you can also use it as a file versioning system.
Identify the problem—and the solution
In my daily routine, I work with a laptop computer where I typically do programming, compilation, edit source code, and update system documentation. In other words, I work with various types of files residing on my laptop's local file system. Usually, I store files on my local file system so I can work on them off-site.
Evidently, there's a clear need for a way to efficiently create backup copies of these files in a safe environment. The solution I outline in this article involves a two- or three-step process. The first step for the backup system is to identify the files being edited. Next, it creates copies of these files and stores the copies in a Lotus Notes database, which resides on the local computer or on a network drive (in my case, I have a personal share on the file server). In the latter case, the job may be finished if the server is backing up the network drive to tape. Otherwise, the third step is to replicate the local database replica with a Domino server, the replica being backed up to tape by the server. If replicating with a Domino server, you can reach the company LAN from the Internet using a Domino passthru server, which makes the solution flexible with respect to network infrastructure.
Backup configuration
The first step of the file backup application is setting up a configuration that specifies how the application scans the local file system for file updates. The files I edit during work reside in a number of different places on my file system. I can usually identify a handful of folders (not counting sub-folders) where I have files being edited during the day. I have, for instance, a couple of project folders, my Internet shortcuts folder, and my desktop folder. In the projects folders, I store different types of files, such as build files, source code files, and compiled binaries. In the context of Lotus Notes, I'll create a form for configuring a backup for a certain folder (and potentially its sub-folders). In that form, I also want to be able to select which types of files to back up from the different folders.
A folder configuration ("folder setup") form facilitates the need to configure the backups for the different folders on the local file system (figure 1).
<figur er gjengitt i orginalutgivelsen>
Figure 1: Folder setup—Details for the Basics tab.
Specifically, the folder setup contains the following parameters:
Include sub-folders. When backing up Java sources, including files from sub-folders is an absolute requirement. In other cases, such as when backing up my Windows desktop, this might not be necessary.
Maximum file size. Backing up large files is time-consuming and can result in a large backup database (especially if a larger number of old backups are kept in the database; more on this later).
What file types to include or exclude. Using my project folder as an example, I might want to back up my Microsoft Word files and my Java source files, but not the temporary files Word sometimes creates, and I definitely don't want backups of all my compiled class files.
How many old backups of a specific file to keep in the database. With this feature, the backup application is, in effect, turned into a file versioning control system while also acting as a backup system.
Access the file system and filtering files for backup
LotusScript libraries offer some access to files and the file system in general. However, for the purposes in this application, these are insufficient. For extended access to the file system, the application uses the scripting possibilities in Microsoft Windows 2000 through the ActiveX/OLE functions accessed via LotusScript.
The solution uses regular expressions to filter the files to be backed up based on file name and type. This is another feature that isn't available in Notes, so once again, I turn to Win2K scripting. The Win2K release includes a regular expression object, which fits the purpose here perfectly.
The syntax of the regular expressions used with the RegExp object is similar to Perl 5 regular expressions. This is a powerful syntax, but unfortunately, far too complex and cumbersome for the average user. To make this easier, I include a feature that lets users define file matching with a Windows console-like syntax (figure 2).
<figur er gjengitt i orginalutgivelsen>
Figure 2: Specifying file-matching filters—Either an inclusion or an exclusion filter is specified.
Store file backups in a database
Now that you've identified the files for backup, the next step is to consolidate these files with the existing backup copies. If no backup copy exists, the system creates one. If the existing backup copy is older than the file on the local file system, it creates a new backup. Moreover, if the number of existing backup copies of a certain file exceeds the maximum defined in the folder setup, it'll delete the oldest copy from the database.
The process of creating a new backup of a given file is simply to create a new document note in the database and attach the file to a rich-text field in the document.
There are a number of ways to view backup files. Figure 3 shows a view where file backups are categorized by the fully qualified path name of the folder in which they reside on disk.
<figur er gjengitt i orginalutgivelsen>
Figure 3: View existing backup copies—You can see how this solution also acts as a file versioning system when old versions of a file are available.
Cost-effective solution
In this article, I've shown the basics of a simple Lotus Notes-based file backup solution by using excerpts of code from a real-life implementation. The solution, which is indeed a lightweight application, has shown to be fit-for-business in supplying the backup safety required, and at the same time offering flexibility and ease-of-use. It has been deployed at BEKK, a mid-sized Norwegian consulting firm where the users are trained professionals used to interacting with Lotus Notes. For a business that has a Lotus Notes and Domino infrastructure in place, such a solution requires no extra licensing cost. The code required to create this solution is fairly simple and limited in size; thus, it's an example of an application where a business can leverage its existing Lotus Notes/Domino infrastructure and use knowledge to implement safety with little in development and user training costs. Even though it doesn't supply entirely the same safety as a professional disk backup system, its cost-benefit ratio is good compared to such products.
**
Artikkelen er utgitt i sin helhet i Advisor Expert, Nov/Des 2002. For kjøp av hele artikkelen, gå til http://lotusadminadvisor.com/doc/11956.