Wikis - Page

Backup Script for GroupWise Data - enhancements

3 Likes
This is an updated version of the GroupWise backup script as it was originally published by Kenny Anderson at https://www.novell.com/coolsolutions/feature/17055.html.

The updates to the script as originally submitted are:

  • changed hard-coded values to Global definitions, making it easier to configure for an environment.

  • introduced a cleanup for keeping a maximum of x days of the archives

  • split POA and DOM backup files to separate archives.

  • changed date format of archive - date-month-Year instead of Month-date-year.

  • introduced checks to see if paths defined in definitions are available to write into.

  • off-site copy is removed for now, local copies/archives will be backed up with normal backup products from the host as FTP is not secure.


As the original script also held a part to send the backup-file offsite/to another host, however in current times storage availability and backup technology the send is not really an issue anymore as hosts are backed up fully quickly (especially virtualised)


#!/bin/sh
# Script to backup GroupWise system
# Current Version : v1.02
###################################################
# The original script was published on https://www.novell.com/coolsolutions/feature/17055.html
# and made by Kenny Anderson, which I see as the Version 1
###################################################
###################################################
# Changes in this version 1.01
# - Changed hardcoded values to Global definitions
# - introduced a cleanup for keeping a maximum of x days of the archives
# (deletes older backup-files based on filetime)
# - Split POA and DOM backup files to separate archives
# - changed date format of archive - date-month-Year instead of Month-date-year
###################################################

###################################################
# Fixes v 1.02
# - Original script had a hardcoded path to the setup of the creator somewhere
# its removed and made to use the global definitions
# - checks for basepath to assure it exists, if not exit the script
###################################################

###################################################
# Global definitions for the script
###################################################
export LD_LIBRARY_PATH=/opt/novell/groupwise/agents/lib
# location of DBcopy
DBcopyDir="/opt/novell/groupwise/agents/bin"
# Groupwise Base Directory for POA and DOM
GWBasedir="/gwdata"
# Groupwise Backup Directory
BackupDir="/gwdata/backup"
#Groupwise POA directory relative to Base
GWPOADir="/gw-poa"
#Groupwise DOM directory relative to base
GWDOMDir="/gw-dom"

# Set maximum backup age in days (for cleanup)
BackupMax=10

# backup Filename for POA
BackupPOAFilename="gwPOAbackup""`date %d%m%y`"".tar"

# backup Filename for DOM
BackupDOMFilename="gwDOMbackup""`date %d%m%y`"".tar"

# Change directory to the GroupWise volume, if not found or correct exit
# required as DBCopy doesn?t like explicit paths (bug?)
if [ ! -d "$GWBasedir" ]; then
exit;
else
cd $GWBasedir
fi

#Clean up backup files older then the defined max archive days
echo "Removing backupfiles older then specified Backupdays"
find $BackupDir -mtime $BackupMax -type f -delete

# Remove any existing backup_po directory and recreate it
if [ -d "$BackupDir/backup_po" ]; then
echo "Removing old POA backupDir"
rm -r $BackupDir/backup_po
echo "Creating POA backupDir"
mkdir $BackupDir/backup_po
else
echo "Creating POA backupDir"
mkdir $BackupDir/backup_po
fi

# Remove any existing backup_dom directory and recreate it
if [ -d "$BackupDir/backup_dom" ]; then
echo "Removing old DOM backupDir"
rm -r $BackupDir/backup_dom
echo "Creating DOM backupDir"
mkdir $BackupDir/backup_dom
else
echo "Creating DOM backupDir"
mkdir $BackupDir/backup_dom
fi

# Copy the GroupWise Post Office to the backup_po directory
$DBcopyDir/dbcopy $GWBasedir$GWPOADir $BackupDir/backup_po/

# Copy the GroupWise domain to the backup_dom directory
$DBcopyDir/dbcopy $GWBasedir$GWDOMDir $BackupDir/backup_dom/

# Combine the backup_po directory to a single .tar tarball
# Files are removed as they are archived to save disk space
tar -c --remove-files -f $BackupDir/$BackupPOAFilename $BackupDir/backup_po/

# Combine the backup_dom directory to a single .tar tarball
# Files are removed as they are archived to save disk space
tar -c --remove-files -f $BackupDir/$BackupDOMFilename $BackupDir/backup_dom/



Labels:

How To-Best Practice
Comment List
Parents Comment Children
No Data
Related
Recommended