Cybersecurity
DevOps Cloud
IT Operations Cloud
#!/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/