Storage Management

Activate your FREE membership today  |  Log-in

  • Visit other TechTarget ANZ sites: 
Posted
Oct 22, 2009
 |  By:  Seiji Shintaku

How to write backup scripts in Perl

Bookmark and Share

If you do on-site storage work for your customers, from time to time you might be called on to script backup procedures. In many environments, Perl scripting works well. I've scripted backup jobs for Exchange and on an EMC Celerra using Perl and have a few tips to share.

For the Exchange job, my financial services client was using SnapManager for Exchange on a NetApp LUN. Although the Exchange server is obviously a Windows server, I decided to use Perl because the customer's Symantec NetBackup server was running Solaris and it's difficult to write something on Windows that will be used on Solaris. And since Perl is pervasive on Solaris and Linux is heavily used in financial institutions, the choice made sense.

In my client's backup of Exchange, we set SnapManager for Exchange to take several important steps:

  1. Quiesce the database (halt IO for several seconds)
  2. Flush the data to the LUN
  3. Take the snapshot
  4. Replicate data to secondary array based on the snapshot
  5. Concatenate the log files
  6. Verify the database (this can be done in a separate job)

Most financial services companies choose to offload the backup job to a secondary array, allowing them to run backups during the day without interrupting service levels for the business users. The key part of doing a successful backup is to ensure that the secondary array has a good point-in-time copy of the data. In the Exchange scenario, since NetApp uses SnapMirror to replicate the data to the secondary array, to determine when the secondary array was up to date, I looked for lag time between the replicated volumes. When the lag times of the volumes for Exchange were set to "00" on the hour field, that was my cue to kick off the backup. I set a counter in my Perl script to count the total number of replicated volumes and ensured all volumes were set to "00." If those conditions were met, a "touch" file would be created.

I used the same methodology for a Celerra backup to tape. The file systems were replicated via Symmetrix Remote Data Facility (SRDF) on an EMC Symmetrix DMX array, and a point-in-time copy, called a Business Continuance Volume (BCV), of the file system was created off of the secondary array. The Perl script would sit in a loop until the BCV was synchronized with the second copy of the file system; the script then split the BCV for a point-in-time copy. Once the volumes were split off, the script created a touch file.

In the case of both the Exchange server backup or the Celerra backup, the touch file was the cue for the backup server to initiate the backup job of the volumes. The batch processing server would have a job running for hours each night looking for this touch file. Once it saw the touch file, the batch processing server would kick off the backup of the application or file system. (If the batch processing server didn't see the touch file during the nightly backup period, the Perl script would instruct it to exit with a failed exit code and send a notification to the backup operators to let them know that the process had failed.)



TechTarget ANZ sites: SearchCIO.com.au | SearchNetworking.com.au | SearchSecurity.com.au | SearchStorage.com.au | SearchVoIP.com.au

WF Online community sites: ElectricalSolutions | ElectronicsOnline | FoodProcessing | InMotionOnline | LabOnline | ProcessOnline | RadioComms | SafetySolutions | SustainabilityMatters | Voice&Data

Copyright © 2010 Westwick-Farrow Pty Ltd. All rights reserved.
About Us | Contact Us | TechTarget