#!/bin/sh # Script to backup GroupWise system # Current Version : v1.03 ################################################### # 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 harcoded 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 ################################################### ################################################### # Enhancements v 1.03 # added options to make a remote backup to a remote host ################################################### ################################################### # 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 # Local backup Filename for POA BackupPOAFilename="gwPOAbackup""`date +%d%m%y`"".tar" # Local backup Filename for DOM BackupDOMFilename="gwDOMbackup""`date +%d%m%y`"".tar" # target machine name to store the off-site backup # This set of variables assumes the Groupwise Server has a ssh-key-trust with the Remote Host # Enable/Disable Remote Host Backup BackupToRemoteHost=1 # Remote Backup Hostname (must be resolvable) BackupRemoteHost="remotehost.somedomain.com" # User to login to the remote server - I recommend a separate user with its homedir set to the backup-location on the remote host BackupRemoteUser="root" # If a separate user is not used ie. root, then specify the remote path where to store the backups BackupRemotePath="/data/gwbackups" # 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 echo "Defined $GWBasedir was not found" 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/ if [ $BackupToRemoteHost -eq 1 ]; then echo "RSynching Backup files to Remote Host using $BackupRemoteUser at $BackupRemoteHost" rsync -avzh --delete -e ssh $BackupDir/ $BackupRemoteUser@$BackupRemoteHost:$BackupRemotePath/ fi