Backup Script for GroupWise Data - enhancements

Backup Script for GroupWise Data - enhancements

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 (1)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Comments

I would check for backup directory existence ( can be on separate disk ) too, like :

 

if [ ! -d "$GWBasedir" ] && [ ! -d "$BackupDir" ]; then

 

 David

Great script;

Wondering if you could add the ability to email the sysadmin upon success or failure of the script, using the built in mail client (even on the GWIA server)?

Like

/usr/bin/mail -s "DBcopy PO backup sucess" sysadmin@domain.com < /etc/HOSTNAME

 

To get a "full report" I gather all output in file like report.txt.

Between activity steps I add a line like 
'echo -e "******** start script ******** at "$(date) \n>>report.txt'

I use the local postfix listening only on localhost (maybe GWIA is on the same machine). Postfix will relay via GWIA.

Finally this statement will close my script:
mail -s "Backup for XY has been done -  $(date)" sysadmin@domain.com <report.txt

 

Diethmar

Thanks for the advice.

I used the two parameters below to ensure I will get success/failure emails when backing up the GW system.

Added 'smtp_bind_address' to /etc/postfix/main.cf with the IP of the OES server (different then GWIA address, which is bound to its IP). This ensures postfix will not conflict with the MTA, POA, GWIA.
And the 'relayhost' is the GWIA IP address.

smtp_bind_address = 192.168.12.161
relayhost = 192.168.12.35

This works on my (and my clients) OES/GW cluster servers & non-cluster servers.

Hope this helps others.

Great script, thanks!

How would you do an incremental backup?

Top Contributors
Version history
Revision #:
7 of 7
Last update:
‎2020-02-21 17:31
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.