Tip

Using Perl to script backup jobs

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

    Requires Free Membership to View

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)
More on Perl scripting in a storage environment
How to manage EMC, NetApp arrays with Perl scripting

NAS filer implementation: Solving three big problems

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 was 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.)

About the author

Seiji Shintaku is a principal consultant for RTP Technology. Before joining RTP Technology, he was global NetApp engineer for Lehman Brothers, Celerra and DMX engineer for Credit Suisse First Boston, principal consultant for IBM, and global Windows engineer for Morgan Stanley. RTP Technology is a VAR for storage-related products and professional services for NetApp, EMC, F5, Quantum, VMware and Brocade. He can be reached at sshintaku@rtptech.com.

This was first published in September 2009

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.