Under normal conditions, pre- and post-replication scripts are not required. Where required to perform specific functions (for example, to stop an application to facilitate a snapshot of its files in a quiescent, consistent state), these custom scripts can be run before or after each instance of a replication.
In the case of a database or other application that requires a consistent state at the time of a snapshot, best practices suggest using scripts and snapshot rules together:
- Pre-replication scripts are executed to completion before the replication is started.
- Post-replication scripts are executed after a successful replication.
Potential uses of scripts are illustrated in the following examples:
- Database replication. A pre-replication script can be used to enable the replication of a consistent copy of the database. Typically, this pre-replication script will need to:
- Shut down the database to bring it into a consistent or quiescent state.
- Take a snapshot of the file system using a snapshot rule.
- Restart the database.
- Backing Up Data from the Replication Target. A post-replication script can initiate incremental (or full) backups from a replication target after each incremental replication has completed. Backing up from the replication target (rather than the original volume or directory) minimizes the performance impact on network users.