Novell Home

Backup Script for GroupWise Data

Novell Cool Solutions: Feature
By Kenny Anderson

Digg This - Slashdot This

Posted: 28 Mar 2006
 

Problem

We recently installed a OES Linux (SP2) server into our environment, with the eventual aim of making it the primary GroupWise server. The server and GroupWise agents are now running perfectly; however, before this server could move into production, we had to solve the problem of how to back the GroupWise system up.

Our current backup software (Backup Exec v9.2 on a NetWare 6.5 server) does not support NSS volumes on Linux. OES, of course, will support many other file systems, but even then the Backup Exec Linux agent does not "understand" TSA's running on Linux. This means there would be no way to safely back up the GroupWise system without shutting down the agents first.

We had four options:

  • Pay about £10,000 to move our backup system to another, OES-friendly package
  • Wait for Symantec to release a TSA-aware Linux agent (I suspect this may never happen)
  • Scrap the Linux server and install NetWare
  • Copy the data to another server, and back it up from there

Solution

The last option seemed the best to us. I came up with the following script (comments added for clarity):

#!/bin/sh
# Script to backup GroupWise system

# Change directory to the GroupWise volume
# required as DBCopy doesn?t like explicit paths (bug?)
cd /media/nss/GRPWISE

# Remove any existing backup directory
rm -r /media/nss/GRPWISE/pobackup/

# Create the backup directory
mkdir pobackup

# Set the backup file name to ?gwbackup? + todays date+?.tar?
BackupFilename="/media/nss/GRPWISE/gwbackup""`date +%m%d%y`"".tar"

# Copy the GroupWise Post Office to the ?pobackup? directory
/opt/novell/groupwise/agents/bin/dbcopy /media/nss/GRPWISE/gwpo pobackup/

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

# Start FTP; everything between the two ?goforit? parts are taken as 
# interactive input by FTP. -v turns on verbose mode for debugging
ftp -v <<goforit

# Connect to the FTP server
open ftpserver.company.com

# Change to binary mode
binary

# Change to the GWBackup directory on the FTP server
cd /DATA/GWBackup

# Delete any existing backup files on the FTP server
delete gwbackup*

# Copy the backup file to the FTP server
put gwbackup*

# Close FTP
quit
goforit

# Delete the backup file from the Linux box
rm $BackupFilename

This creates a single tarball containing the post office in /media/nss/GRPWISE/gwpo, copies it to the /DATA/GWBackup directory on the FTP server and then deletes the backup file on the Linux server. This file can then be backed up from the FTP server like any other file. To conserve disk space on the FTP server, previous backups are deleted.

Specifying Credentials

Unless you're allowing anonymous FTP users, you'll want to specify credentials that the script can use to log into the FTP server. We could have hard-coded these into the script, but that's not very secure. There is a better way: create a .netrc file in the home directory of the user that will be running the script. The .netrc files have a very simple format:

machine <ftp server IP or DNS>
login <ftp user name>
password <ftp user password>

For example, the ~/.netrc file we use with the above script looks like this:

machine ftpserver.company.com
login backupuser
password backupuserpassword

Testing

After you've created the file, you'll need to chmod 600 the file for it to work. You can test it by manually ftp-ing to the FTP server - if you log straight in without being asked for a username or password you'll know it's working.

Once the script is created and tested, it can be set to run automatically. Use the crontab -e command to create a cron entry for the script to run as often as you like.

Conclusion

The main disadvantage of this method is it uses a lot of disk space. The GroupWise volume on Linux must have at least the size of the post office again in free space for the copy to be taken. To free up the space used as quickly as possible, the copy of the post office is deleted as it's archived, and the tarball is deleted after it's been transferred to the FTP server.

The script can be easily extended to back up other post offices or domains at the same time. It's not perfect (no logging or error trapping for a start), but hopefully this script will provide a starting point for someone looking to get simple backups of their Linux-based GroupWise system.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell