Not too long ago, data backup was controlled by backup scripts, which were written by the people who used them. Scripts selected the files and directories to be backed up, when they would be backed up, and where and how the backups would be stored.
Mercifully, those days are gone. The availability of backup software with rich functionality integrates the functions performed by most scripts into the software itself, making it easier to use, and relieving the administrator of the need to write and maintain scripts for basic backup functions. But backup scripts can still be invaluable tools for storage and backup administrators. They let you automate tedious tasks such as such as making mass changes or administering multiple servers, and customize backup functions.
In addition, many applications and backup programs come with their own APIs that allow scripting within the application. The classic example is VMware, which comes with an API and a number of tools that encourage scripting. For example, the VMware VI Toolkit provides a powerful, flexible client-side tool for scripting for backup and other functions in Windows using the .NET environment. VMware has also issued a Developers Guide for VMware Infrastructure .Net toolkit to help guide would-be scripters through the process. For example, if you need to add a directory to be backed up on all your servers and you can't do it from within the backup application, you may want to write a script to make the changes rather than trying it do it manually. You can use scripts or APIs to do jobs like failing over one server to another in case of a problem.
Backup products like Acronis True Image Corporate Workstation typically also include a scripting language. Often these products will use a standard language such as XML or Visual Basic to make the job of scripting for them easier. (However, be sure to study the documentation. The backup software may offer only a subset of the language or differ in other significant ways.)
In addition, Microsoft has released the Windows PowerShell, a next-generation shell for Windows for applications such as backup.
The advantages of backup scripts
Still, the pendulum has swung so much the away from scripting that some storage and backup administrators try to manage their systems without any scripting at all, either because they don't feel comfortable using scripts or because they don't realize what scripts can do for them.
This is a mistake because scripts have a lot to offer administrators of all stripes. Scripts can save time and effort on jobs which have to be done over and over again by automating them. Scripts also greatly increase the flexibility of the software do perform even complex tasks, such as pruning files to be backed up according to complex criteria, or applying the same changes across multiple servers. This is especially true of backup, where most of the jobs are by definition repetitive and a high degree of customization is often desirable.
Microsoft has offered its ScriptCenter, a large collection of scripts for automating Windows administration tasks, and other vendors and sites have similar collections of scripts for their products.
Are backup scripts worth it?
In deciding whether or not to make scripting a key component of your backup plan, you have to weigh the pros and cons of using scripts.
Customization is the main thing scripting offers administrators -- the ability to do a job exactly as you want to by stringing together commands and utilities to produce the precise output desired without a lot of manual intervention. If you really need something done that isn't part of your standard backup software, then you need to look seriously at using scripts. If it's something that you'd just like to have, then think about what you're letting yourself in for.
One common example is the need to integrate your backup software with another application. If you need to, say, pull information from your backup software and put it into a spreadsheet to generate a special report you may want to use a script. This is going to vary from backup program to backup program. While all of them have the same basic functions, they differ in the details. If you need something that isn't included in your specific backup program, then a script can often provide the functionality.
The disadvantages of backup scripts
The downside to scripts is they require a lot of work, and the more they do the more work is involved. Scripts have to be written, debugged and maintained. Debugging is not necessarily simple and maintenance entails a long-term commitment. Remember, changes in your environment may mean you have to change the affected scripts. Scripts also require a certain amount of knowledge of utilities and often a language like Perl or a shell scripting language like Bash.
Whether writing your own script or using a prewritten one, there are two cardinal rules. The first one is to test the script thoroughly before putting it into production. This includes checking under boundary conditions, seeing what happens when you switch to daylight savings time, and other common occurrences.
The second rule is to comment the heck out of the script. It may seem simple to you when you've just written it, but it may not be so simple in a year or so. Also remember the person who wrote the script won't always be the one using it. This is also a good reason not to get fancy if you don't have to.
About the author: Rick Cook specializes in writing about issues related to storage and storage management.
Do you have comments on this tip? Let us know.
Please let others know how useful this tip was via the rating scale below. Do you know a helpful backup tip, timesaver or workaround? Email the editors to talk about writing for SearchDataBackup.com.