Avamar: How To Use Pre-Script And Post-Scripts For Linux And UNIX Clients
Summary: Some applications may require that they be stopped and restarted when a backup is run or completed. This process can be performed by using prescripts or postscripts with a dataset for the Linux/UNIX/AIX/HP-UX/OSX Avamar clients. ...
Instructions
Some applications may require that they be stopped before a backup starts and restarted when the backup ends. This process can be run using prescripts and postscripts with a dataset for the Linux/UNIX/AIX/HP-UX/OSX Avamar clients.
To run any pre-postscripts, they must be executable and placed in: /usr/local/avamar/etc/scripts
Refer to the Avamar Administration guide for more information.
If the scripts fail to perform as expected, it is recommended to contact Dell Professional Services for assistance.
To verify that prescripts and postscripts work properly in Avamar, create a simple script that outputs some simple information to a text file.
Sample bash script:
Copy the contents below and place it in a file called test.sh on the client:
#!/bin/bash echo "Testing script" > test.txt
Sample Perl Script:
Copy the contents below and place it in a file called test.pl on the client:
#!/usr/bin/perl
use strict;
use warnings;
my $file = ("perlscriptest.txt");
open(FILE, ">$file") || die("Couldn't open file");
print FILE "testing perl script\n";
close (FILE);
exit (0);
Change the script Access Control Lists (ACLs) to all the script to run:
chmod a+x script_filenamePlace the test script in:
/usr/local/avamar/etc/scripts
Add the
script_filename to the prescript in Advanced options of the dataset.
Run a test backup and look for the test.txt file of the client in
/usr/local/avamar/etc/scripts.
Getting script errors
2013-04-02 13:29:07 avtar Info <5916>: Executing run-at-start '/usr/local/avamar/etc/scripts/BDAbackupscript.sh' 2013-04-02 13:29:08 avtar Info <6033>: Begin STDERR from run-at-start: avspawn::spawn after execve errno:8 code 8: Exec format error 2013-04-02 13:29:08 avtar Info <6034>: End of STDERR 2013-04-02 13:29:08 avtar Info <5917>: Back from run-at-start, exit code 8 2013-04-02 13:29:08 avtar Error <7001>: Exiting avtar with run-at-start script failure 8
In this error, Avamar looks for what the script syntax is and tries to identify what shell is being used to invoke the script.
When a script is used with the flags --run-at-start and --run-at-end flags, the first line of the script must define the shell to use.
Generic definition:
"#!<program>"
This is standard practice when using scripts. It defines the shell or command processor that the shell code runs under.
EXAMPLES:
An SH script would begin with:
#!/bin/sh
A CSH script would begin with:
#!/bin/csh
A PERL script would begin with:
#!/usr/bin/perl
The customer is responsible for the correct functioning of the code.
The customer is responsible if there are any issues running prescripts or postscripts. Avamar is not responsible for debugging the scripts or making sure that the correct syntax is being used.