05022004_140813_1.png
Backup Strategy

For FirstClass 7.1 and 8.0 on Mac OS X 10.2.6 or later and Red Hat Linux 9 or later


Document Version 1.0-7 - 10 February 2004


Werner de Jong, Professional Services Manager
Open Text Corporation - FirstClass Division




Download the scripts as a .dmg archive file

Contents

1. Introduction

2. What Needs to be Backed up?

2.1 Offline and Online Backups

3. Enabling FirstClass Mirroring

4. Automated Backups

4.1 The fcbackup.sh Script

4.2 The fcbackuppo.sh and fcbackupmirror.sh Scripts

4.3 Running the Scripts

5. Scheduled Backups

6. Restoring Data from Backups

Appendix A. Configuring your System to run an RSYNC Server




1. Introduction

The FirstClass Network Store (a new name for the FirstClass Post Office, with the new folder name "fcns", changed from "fcpo") contains all messages, documents and uploaded files. Needless to say, preservation of this information is of paramount importance. Therefore every FirstClass Server installation requires a backup strategy.

This document provides information on how to configure FirstClass 7.1 or later for Mac OS X for reliable backups by using the UNIX powers of this unique Operating System. It also describes how to achieve the same for FirstClass 7.1 or later on Red Hat Linux.

Return to contents




2. What Needs to be Backed up?

On Mac OS X, the following two folders (and all sub-folders) need to be backed up:

/Library/FirstClass Server                              FirstClass software, including the Network Store, to be backed up at least once per month.      
/Library/FirstClass Server/Volumes/Master/fcns  The default "live" Network Store, to be backed up daily.        
/Library/FirstClass Server/Volumes/XXXX/fcns    Where XXXX are other volumes that have been approved for use with FirstClass and contain users/conferences.     

On Red Hat Linux, the following folders and sub-folders need to be backed up:

/opt/fcsd                                                               FirstClass software, including the Network Store, to be backed up at least once per month.      
/var/opt/fcsd/volumes/master/fcns                       The default "live" Network Store, to be backed up daily.        
/var/opt/fcsd/volumes/XXXX/fcns                 Where XXXX are other volumes that have been approved for use with FirstClass and contain users/conferences.     

Note: Multiple Network Stores work in conjunction with each other and thus must be backed up and restored as a set.

Important: you can NOT create a reliable backup of the Network Store while FirstClass Server is running with any other software other than FirstClass Mirroring - despite what a third party product may offer in terms of online backups!

Return to contents




2.1 Offline and Online Backups

There are two methods available to backup FirstClass Server:

·       Offline backups - FirstClass Server is down while a backup is run.
·       Online backups - FirstClass Server remains up while a backup is run, which can be achieved exclusively by using FirstClass Mirroring.

For offline backups, the administrator can simply shutdown the server and run the backup software.

Pros:
·       Minimum amount of disk space requirements.
·       Simple to setup.
·       Simple to restore.

Cons:
·       System unavailable during backup.
·       A disk failure will result in loss of data of at most one day.

For online backups, the administrator will have to enable FirstClass Mirroring. When the backup software is run, the Mirror needs to be paused by the Administrator. After the completion of the backup, the Mirror can be re-started (continued). FirstClass will take care of the re-synchronisation.

Pros:
·       System available during backup.
·       Protected against disk failures without loss of data (assuming you mirror to a separate storage device).
·       Simple to setup.
·       Immediate recovery in the event of loss of the main PO.

Cons:
·       A separate disk system (device or networked) is required for optimal reliability.
·       Some minimal additional work needs to be done to restore data.

Return to contents




3. Enabling FirstClass Mirroring

To configure FirstClass Mirroring, you need to create a folder or a symbolic link (Mac OS X aliases do not work) to a folder that may reside on a networked machine in the /Library/FirstClass Server/Volumes (Mac OS X) or /var/opt/fcsd/volumes (Linux) folder. The default volume is called Master (or "master" on Linux), which is where the FirstClass Network Store is created upon software installation.

The easiest way is to create a folder called "Mirror" inside the /Library/FirstClass Server/Volumes (/var/opt/fcsd/volumes for Linux) folder. Ideally, this folder should be a symbolic link to a folder on a secondary disk (not the root) or a networked folder. In this case, you are protected against primary hard disk failures.

To create a link to a folder Mirror on a Windows machine called hostname on a Mac OS X system using the SMB protocol, you can use the Terminal (in the Applications, Utilities folder) to enter the following commands:

[machine-name:~] fcadmin% cd /Library/FirstClass\ Server/Volumes
[machine-name:/Library/FirstClass Server/Volumes] fcadmin% mount_smbfs -I hostname //workgroup\;userid:password@server/share ./Mirror

Or to create an AppleShare link to another Mac OS X system:

[machine-name:/Library/FirstClass Server/Volumes] fcadmin% mount_afp afp://userid:password@hostname/share ./Mirror

Or if you used Filer to connect to a networked machine:

[machine-name:/Library/FirstClass Server/Volumes] fcadmin% ln -s /Volumes/hostname/share ./Mirror

On Red Hat Linux, you can achieve a similar result with an NFS or an SMB mount, but you have to be logged in as "root". For example:

[root@machine-name /]# cd /var/opt/fcsd/volumes
[root@machine-name volumes]# mount -t smbfs -o username=user,password=password,uid=fcadmin,gid=adm //hostname/share ./mirror

This volume can now be made available to FirstClass. To enable the volume for FirstClass Mirroring, you need to login to FirstClass as user "admin" and double click on the Volumes icon.

A list of available volumes will appear, with one volume marked as "primary". The volume that we have just created is included in the list. You need to control-click (Linux: right-click) on this volume and select the Get Info (Linux: Properties) option from the context menu.

A new window is opened. The status of the new volume needs to be changed to "Limited use" from "Browse only". Although you can use "Full Use" volumes for mirroring, it will complicate the restore of mirror volumes and should only be used if the secondary volume is to be utilised for creation of users and conferences.

After you close this window, you will see the change in status in the volumes list.

Next you need to control-click (Linux: right-click) on the primary volume and select the Get Info (Linux: Properties) option. Select the Disk Mirroring tab and enable the mirroring for this volume by clicking the checkbox. Then select the volume that you have just approved from the dropdown box. Click the OK button to start FirstClass Mirroring.

Note:  If you have multiple volumes approved for Full Use and containing FirstClass user or conference data, they must ALL be set up to mirror.  You cannot choose to mirror a primary volume and not to mirror a secondary volume that contains conferences.

For more information, please refer to the FirstClass Administrator's Guide.

Return to contents




4. Automated Backups

Both backup methods can be automated by using AppleScript or Bourne Shell scripts. Bourne Shell scripts can be scheduled using the standard "crontab" utility, which is available on Mac OS X and Linux.

There are five sample scripts attached to this document, which are Bourne Shell scripts. Three of these scripts use the "rsync" command as a way to backup data. "rsync" is a fast remote-update protocol enabling the transfer of the differences between two sets of files across a network link. An rsync'ed copy of the FirstClass data can be used for writing to relatively slow mediums, for example tapes.

fcbackup.sh                     A fully featured application to control your backups, including support for daily, weekly and monthly rollovers.        
fcbackuppo.sh           Stops the FirstClass Server, copies Network Store to another folder and restarts the Server.    
fcbackupmirror.sh               Pauses the FirstClass Mirror, copies mirrored data to another folder and resynchronises the Mirror.     

The first script (fcbackup.sh) is the most sophisticated and user-friendly one, which can be used in any situation, whether you have enabled mirroring or not.

Of the remaining two, you should use the correct one, depending on whether you have enabled FirstClass Mirroring (use fcbackupmirror.sh) or not (use fcbackuppo.sh).

The last two scripts stop and re-start mirroring, which is required to provide a window for backing up the Mirrored Network Store by an external (third party) backup tool:

stopmirror.sh           Stops FirstClass Mirroring, to be run before starting the external backup tool. 
startmirror.sh          Restarts FirstClass Mirroring, to be run after the backup completed.    

If you have approved multiple volumes for full use and these volumes contain user or conference data, you must pause ALL FirstClass Mirroring and backup ALL mirrored Network Stores at the same time. You will need to modify the scripts accordingly. Only the fcbackup.sh script is capable of backing up all Network Stores and Mirror folders automatically, without any modifications.

Return to contents




4.1 The fcbackup.sh Script

The fcbackup.sh script can be fully controlled with command-line options. There are no source code changes required.

The command usage is as follows:

fcbackup.sh [-hfndmwvV] [-l file] [-t tracelevel] mirror | fcns | apps [destination]

The following command-line options are available:

-h                      Display this information.       
-f                      Force stop of FirstClass Core Server and Internet services while backing up application folder. 
-n                      Prevents automated backup from setting owners and permissions, useful when copying across a network.    
-d                      Use a daily backup rollover (optional). Every time this application runs, it overwrites a previous backup. Storage required is twice the size of your Network Store.    
-m                      Use a monthly backup rollover (optional). For creating daily backups, allowing a rollback of one month. Storage required is 31 times the size of your Network Store.    
-w                      Use a weekly backup rollover (optional). For creating daily backups, allowing for a rollback of one week. Storage required is 7 times the size of the Network Store. This behavior is the default.      
-v                      Display application version number and release date.    
-V                      Display application version number and release date and exit.   
-l file                 Write the output to the specified log file. Upon reaching the maximum log file size (100 Kbytes), the file will be backed up and a new one is started.  
-t tracelevel           Set trace/logging level: 6 = exceed, 5 = verbose, 4 = info, 3 = warning, 2 = error, 1 = fatal. Verbose is the default level.    
mirror | fcns | apps    Either backup the Mirror (while Mirror is paused), the FirstClass Network Store (while server is down) or the
FirstClass Application folder (by default while server is running). This is the only mandatory parameter.       
[destination]           The backup destination folder (optional). This script attempts to create the full path if it does not exist, as long as it is on a local device. You can backup from the local machine to a remote rsync server. This is invoked when the destination path contains a :: separator or an rsync:// URL. The default folder is /Library/FirstClass Server/Backup for Mac OS X and /opt/var/fcsd/Backup for Linux. 

We strongly recommend the use of an external volume as backup destination.

The fcbackup.sh script can automatically backup all Network Stores or Mirrored Network Stores in all available Volumes. It automatically stops the server or pauses mirroring as required, and starts the server or continues mirroring after the backup has finished.

Below are some examples:

Command:                fcbackup.sh -l /FCBackup/backup.log fcns /FCBackup      
Destination folder:     /FCBackup       
Backing up:             Primary Network Store (fcns)    
Rollover period:        Weekly (default)        
Backup path:            /FCBackup/<weekday>/<volumename>/<networkstore> 
Example:                /FCBackup/Tuesday/Master/fcns   

Command:                fcbackup.sh -d fcns /FCBackup   
Destination folder:     /FCBackup       
Backing up:             Primary Network Store   
Rollover period:        Daily   
Backup path:            /FCBackup/<volumename>/<networkstore>   
Example:                /FCBackup/Master/fcns   

Command:                fcbackup.sh -t6 -l /FCBackup/backup.log mirror /FCBackup        
Destination folder:     /FCBackup       
Backing up:             Mirrored Network Store  
Rollover period:        Weekly (default)        
Backup path:            /FCBackup/<weekday>/<volumename>/<networkstoremirror>   
Example:                /FCBackup/Tuesday/Mirror/fcns8001       

Command:                fcbackup.sh -fm apps /FCBackup  
Destination folder:     /FCBackup       
Backing up:             Application Folder while FirstClass Server is stopped (-f option)       
Rollover period:        Monthly 
Backup path:            /FCBackup/<monthday>/<appsfolder>       
Example:                /FCBackup/Day21/FirstClass Server       (Mac OS X)
                        /FCBackup/Day21/fcsd                    (Linux) 

Command:                fcbackup.sh -l /tmp/backup.log mirror rsync://host/backup       
Destination folder:     /FCBackup       
Backing up:             Mirrored Post Office to a remote RSYNC server   
Rollover period:        Weekly (default)        
Backup path:            rsync://host/backup/<weekday>/<volumename>/<networkstoremirror> 
Example:                rsync://host/backup/Tuesday/Mirror/fcpo8001     

Return to contents




4.2 The fcbackuppo.sh and fcbackupmirror.sh Scripts

The fcbackuppo.sh and fcbackupmirror.sh scripts have been pre-configured for Mac OS X as follows:

·       The Network Store is located at /Library/FirstClass Server/Volumes/Master (POPATH)
·       The Mirrored Network Store is located at /Library/FirstClass Server/Volumes/Mirror (MIRRORPATH)
·       The Backup folder is located at /Library/FirstClass Server/Backup (BACKUPPATH)
·       The Backup log file is called /Library/FirstClass Server/Backup.log (BACKUPLOG)

These paths should be changed for Linux systems:

·       The Network Store is located at /var/opt/fcsd/volumes/master (POPATH)
·       The Mirrored Network Store is located at /var/opt/fcsd/volumes/mirror (MIRRORPATH)
·       The Backup folder is located at /var/opt/fcsd/backup (BACKUPPATH)
·       The Backup log file is called /var/opt/fcsd/backup.log (BACKUPLOG)

The scripts contain some simple code to check if the Network Store or the Mirrored Network Store and Backup sub-folders exist. If the Backup destination does not exist, the script will attempt to create the folder. If the Network Store or the Mirrored Network Store can not be found or the Backup destination can not be created, the backup will fail.

You can modify these settings by editing the scripts in any text editor (for example: TextEdit or vi). We strongly recommend the use of an external volume as backup destination.

Return to contents




4.3 Running the Scripts

All scripts need to be run by the Mac OS X or Linux user "fcadmin".

If this fails, then the issue is likely permissions related. You should run "fcfixvol", and ensure all work is done within the "fcadmin" account.

Although we do not recommend or require the use of "root" for FirstClass Server or Internet Services, you could run the scripts as "root". On Mac OS X Client you will need to enable the "root" user first (on Mac OS X Server this user is enabled by default, and always available on Linux). This can be done with Netinfo Manager in the Applications, Utilities folder. Click the lock to allow changes to this form, and select the Security->Enable Root User menu option. You will be prompted to set a password for the root user. Don't forget to click the lock again to prevent further changes.

To run the scripts, save the files to a convenient location, for example for a Mac OS X system in /Library/FirstClass Server, open a Terminal and enter the following commands to backup the FirstClass Mirror:

[machine-name:~] fcadmin% chmod +x /Library/FirstClass\ Server/fcbackup.sh
[machine-name:~] fcadmin% /Library/FirstClass\ Server/fcbackup.sh -t6 mirror
10Feb04 11:16:17 - (Info) FirstClass Automated Backup 1.0-7 (Darwin) Started
10Feb04 11:16:17 - (Exceed) Skipping Post Office 'Master/fcpo': Mirror backup requested
10Feb04 11:16:17 - (Verbose) Pausing FirstClass Mirroring...
/usr/sbin/fcsctl pause: Pause mirror(s) signal sent to FirstClass Core Server (fcsd) process (7593).
10Feb04 11:16:17 - (Exceed) Waiting 600 seconds for command to complete...
10Feb04 11:26:17 - (Verbose) FirstClass Mirroring Paused
10Feb04 11:26:17 - (Info) Backing up Mirror 'Mirror/fcpo8001'
10Feb04 11:26:17 - (Verbose) Synchronizing Data...
10Feb04 11:26:18 - (Exceed) Attempting to create destination folder
10Feb04 11:26:18 - (Verbose) Preserving all file attributes
10Feb04 11:26:18 - (Verbose) Copying from: /Library/FirstClass Server/Volumes/Mirror/fcpo8001
10Feb04 11:26:18 - (Verbose) Copying to: /Library/FirstClass Server/Backup/Tuesday/Mirror

Number of files: 2563
Number of files transferred: 2362
Total file size: 42061286 bytes
Total transferred file size: 42061286 bytes
Literal data: 42061286 bytes
Matched data: 0 bytes
File list size: 29515
Total bytes written: 42197961
Total bytes read: 47260

wrote 42197961 bytes  read 47260 bytes  722140.53 bytes/sec
total size is 42061286  speedup is 1.00
10Feb04 11:27:16 - (Verbose) Data Synchronized in 0:00:59
10Feb04 11:27:16 - (Verbose) Continuing FirstClass Mirroring...
/usr/sbin/fcsctl continue: Continue mirror(s) signal sent to FirstClass Core Server (fcsd) process (7593).
10Feb04 11:27:17 - (Exceed) Waiting 5 seconds for command to complete...
10Feb04 11:27:22 - (Verbose) FirstClass Mirroring Continued
10Feb04 11:27:22 - (Info) FirstClass Automated Backup 1.0-7 (Darwin) Finished
[machine-name:~] fcadmin% exit
logout
[Process completed]

The "chmod" command makes the scripts executable, which only needs to be done once.

To initiate a backup to a remote RSYNC server with IP address 172.31.1.156, the command and output look like this:

[machine-name:~] fcadmin% /Library/FirstClass\ Server/fcbackup.sh -t6 fcpo rsync://172.31.1.156/backup
10Feb04 11:31:27 - (Info) FirstClass Automated Backup 1.0-7 (Darwin) Started
10Feb04 11:31:27 - (Verbose) Stopping FirstClass Core Server...
/usr/sbin/fcsctl stop: FirstClass Core Server (fcsd) stopped (7807).
fcsd: Signal received - SIGTERM (fast shutdown).
10Feb04 11:31:27 - (Exceed) Waiting 30 seconds for command to complete...
10Feb04 11:31:57 - (Verbose) FirstClass Core Server Stopped
10Feb04 11:31:57 - (Info) Backing up Post Office 'Master/fcpo'
10Feb04 11:31:57 - (Verbose) Synchronizing Data...
10Feb04 11:31:58 - (Warning) Connecting to remote rsync server
10Feb04 11:31:58 - (Verbose) Preserving all file attributes
10Feb04 11:31:58 - (Verbose) Copying from: /Library/FirstClass Server/Volumes/Master/fcpo
10Feb04 11:31:58 - (Verbose) Copying to: rsync://172.31.1.156/backup/Tuesday/Master

Number of files: 2575
Number of files transferred: 2374
Total file size: 42133536 bytes
Total transferred file size: 42133536 bytes
Literal data: 42133536 bytes
Matched data: 0 bytes
File list size: 29239
Total bytes written: 42261033
Total bytes read: 38024

wrote 42261033 bytes  read 38024 bytes  4976359.65 bytes/sec
total size is 42133536  speedup is 1.00
10Feb04 11:32:07 - (Verbose) Data Synchronized in 0:00:08
10Feb04 11:32:07 - (Exceed) Skipping Mirror 'Mirror/fcpo8001': Post Office backup requested
10Feb04 11:32:07 - (Verbose) Starting FirstClass Core Server...
Falling back to user 'fcadmin' (502).
/Library/FirstClass Server/./fcsd.rez: OK
FirstClass Server now running as daemon process 7863.
Server was started as user 'root' (0) in group 'staff' (20).
Server now running as user 'fcadmin' (502) in group 'admin' (80).
fcsd: Operating system last booted: Mon Feb  9 09:15:58 2004
fcsd: Number of processors installed: 1
fcsd: System open file limit: 30000 files
fcsd: System open file (VNODE) limit: 30000 vnodes
fcsd: Server open file limit: 30000 files
fcsd: This server is configured for 15 network sessions.
Created 10 OS worker threads.
fcsd: FirstClass Server 7.1 (Build 135) started.
/usr/sbin/fcsctl start: FirstClass Core Server (fcsd) started (7863).
10Feb04 11:32:12 - (Exceed) Waiting 5 seconds for command to complete...
10Feb04 11:32:17 - (Verbose) FirstClass Core Server Started
10Feb04 11:32:17 - (Info) FirstClass Automated Backup 1.0-7 (Darwin) Finished
[machine-name:~] fcadmin%

Alternatively, you can start the script as a parameter to the Bourne Shell:

[machine-name:~] fcadmin% /bin/sh -c "/Library/FirstClass\ Server/fcbackup.sh mirror"

On a Linux system, a backup of the primary Network Store would require the following command:

[fcadmin@machine-name fcadmin]$ /opt/fcsd/fcbackup.sh -t6 fcns rsync://172.31.1.12/backup
10Feb04 11:37:02 - (Info) FirstClass Automated Backup 1.0-7 (Linux) Started
10Feb04 11:37:02 - (Verbose) Stopping FirstClass Core Server...
/opt/fcsd/fcsctl stop: FirstClass Core Server (fcsd) stopped (6595).
10Feb04 11:37:03 - (Exceed) Waiting 30 seconds for command to complete...
fcsd: Signal received - SIGTERM (fast shutdown).
10Feb04 11:37:33 - (Verbose) FirstClass Core Server Stopped
10Feb04 11:37:33 - (Info) Backing up Post Office 'master/fcpo'
10Feb04 11:37:33 - (Verbose) Synchronizing Data...
10Feb04 11:37:33 - (Warning) Connecting to remote rsync server
10Feb04 11:37:33 - (Verbose) Preserving all file attributes
10Feb04 11:37:33 - (Verbose) Copying from: /var/opt/fcsd/volumes/master/fcpo
10Feb04 11:37:33 - (Verbose) Copying to: rsync://172.31.1.12/backup/Tuesday/master
rsync[6786] (sender) heap statistics:
 arena:         802816   (bytes from sbrk)
 ordblks:           19   (chunks not in use)
 smblks:             2
 hblks:              0   (chunks from mmap)
 hblkhd:             0   (bytes from mmap)
 usmblks:            0
 fsmblks:           80
 uordblks:      658432   (bytes used)
 fordblks:      144384   (bytes free)
 keepcost:      126368   (bytes in releasable chunk)
Number of files: 6315
Number of files transferred: 5991
Total file size: 199256548 bytes
Total transferred file size: 199256548 bytes
Literal data: 199256548 bytes
Matched data: 0 bytes
File list size: 66336
Total bytes written: 199581106
Total bytes read: 95896
wrote 199581106 bytes  read 95896 bytes  3663798.20 bytes/sec
total size is 199256548  speedup is 1.00
10Feb04 11:38:27 - (Verbose) Data Synchronized in 0:00:54
10Feb04 11:38:27 - (Verbose) Starting FirstClass Core Server...
/opt/fcsd/./fcsd.rez: OK
FirstClass Server now running as daemon process 6801.
Server was started as user 'root' (0) in group 'fcadmin' (501).
Server now running as user 'fcadmin' (501) in group 'adm' (4).
fcsd: Server open file limit: 65536 files
fcsd: This server is configured for 50 network sessions.
Created 18 OS worker threads.
fcsd: FirstClass Server 7.1 (Build 135) started.
/opt/fcsd/fcsctl start: FirstClass Core Server (fcsd) started (6801).
10Feb04 11:38:33 - (Exceed) Waiting 5 seconds for command to complete...
10Feb04 11:38:38 - (Verbose) FirstClass Core Server Started
10Feb04 11:38:38 - (Info) FirstClass Automated Backup 1.0-7 (Linux) Finished
[fcadmin@machine-name fcadmin]$

Return to contents




5. Scheduled Backups

The scripts can be scheduled using the "crontab" utility. You can create a text file (called a crontab file), enter the time and frequency that you want to run the script and pass it to the "cron" process. A crontab file consists of lines of six fields each. The fields are separated by spaces or tabs. The first five are integer patterns that specify the following:

minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).

Each of these patterns may be either an asterisk (meaning all legal values) or a list of elements separated by commas. An element is either a number or two numbers separated by a minus sign (meaning an inclusive range). Note that the specification of days may be made by two fields (day of the month and day of the week). Both are adhered to if specified as a list of elements.

The sixth field of a line in a crontab file is a string that is executed by the shell at the specified times. A percent character in this field (unless escaped by \) is translated to a NEWLINE character.

Only the first line (up to a `%' or end of line) of the command field is executed by the shell. Other lines are made available to the command as standard input. Any line beginning with a `#' is a comment and will be ignored. The file should not contain blank lines.

For example, create a file called "cronjobs.txt" containing the following three lines, which will backup the FirstClass Network Store Mirror every weekday morning at 1:15am and at 5am on Saturday and Sunday (see example attachment cronjobs-rsync-backup.txt), using a weekly rollover period and the default backup destination. It will also backup the FirstClass Applications folder every Sunday at five past midnight, using a monthly rollover period. The output is redirected to a file:

5  0 * * 0   /bin/sh -c "/Library/FirstClass\ Server/fcbackup.sh -l /tmp/backup.log -m apps"
15 0 * * 1-5 /bin/sh -c "/Library/FirstClass\ Server/fcbackup.sh -l /tmp/backup.log mirror"
0  5 * * 0,6 /bin/sh -c "/Library/FirstClass\ Server/fcbackup.sh -l /tmp/backup.log mirror"

The corresponding Linux cronjobs.txt file would look like this:

5  0 * * 0   /bin/sh -c "/opt/fcsd/fcbackup.sh -l /tmp/backup.log -m apps"
15 0 * * 1-5 /bin/sh -c "/opt/fcsd/fcbackup.sh -l /tmp/backup.log mirror"
0  5 * * 0,6 /bin/sh -c "/opt/fcsd/fcbackup.sh -l /tmp/backup.log mirror"

Alternatively, you can use "crontab" to schedule a backup window (see example attachment cronjobs-external-backup.txt):

10 0 * * 1-5 /bin/sh -c "/opt/fcsd/stopmirror.sh"
10 2 * * 1-5 /bin/sh -c "/opt/fcsd/startmirror.sh"

Here mirroring is paused every working day at ten minutes past midnight, and re-synchronised at ten minutes past two.

To schedule these jobs, open a Terminal and enter the following commands:

[machine-name:~] fcadmin% crontab /Library/FirstClass\ Server/cronjobs-rsync-backup.txt
[machine-name:~] fcadmin% exit
logout
[Process completed]

You can use the following command to check if your cronjobs have been loaded properly:

[machine-name:~] fcadmin% crontab -l
0  0 * * 0   /bin/sh -c "/Library/FirstClass\ Server/fcbackup.sh -l /tmp/backup.log -m apps"
15 0 * * 1-5 /bin/sh -c "/Library/FirstClass\ Server/fcbackup.sh -l /tmp/backup.log mirror"
0  5 * * 0,6 /bin/sh -c "/Library/FirstClass\ Server/fcbackup.sh -l /tmp/backup.log mirror"
[machine-name:~] fcadmin%

These jobs remain scheduled, even if you reboot your system. To remove them, you can use the command “crontab –r”.

All you have to do is to check the /tmp/backup.log file regularly for errors.

Return to contents




6. Restoring Data from Backups

In case of a total system crash, it is recommended that you re-install FirstClass Server in order to restore Desktop icons and the automatic start-up scripts, and then restore the FirstClass Applications folder from your most recent backup, followed by restoring the Network Store.

For further information, please refer to the "Restoring your Network Store" (or "Restoring your Post Office") section in the FirstClass Administrator's Guide, which can be found in the Online Books folder inside the Admin Help folder on the Administrator's Desktop in FirstClass.

Return to contents




Appendix A. Configuring your System to Run an RSYNC Server

Important note: You will have to be confident using the Terminal application and a plain-text editor like vi, before you try this. Mistakes might require you to re-install the Operating System!

An alternative to using shared folders is to configure an rsync server on a remote machine. This can be another Mac OS X system, or any Linux server. Most Linux servers have rsync server already enabled.

Unfortunately, the version of rsync (2.5.7) that is installed on Mac OS X 10.2.8 or earlier does not work properly. In this case you need to download the latest version of rsync from http://samba.anu.edu.au/rsync/, compile the software (there is no binary distribution for Mac OS X available) and install it. For compiling source code on your Mac, you need to install the development supplement from the Mac OS X CD-ROM. The rsync version at the moment of writing is 2.6.0. For detailed instructions, please check out the documentation provided with the rsync source code.

To enable rsync server on a Mac OS X system, you will have to go through the following steps:

o       Configure system files for rsync to run as a server.
o       Create a folder for the automated backups.
o       Create an rsyncd.conf file.

In order to enable rsync to run as a server, you will have to add a line to the file /etc/inetd.conf and a line to the file /etc/services. These files are system files, and you need admin access (as "root" user, or with the "sudo" command) to modify them.

Assuming that "/usr/bin/rsync" is the path to where you have rsync installed on your system, the following line needs to be added to /etc/inetd.conf:

        rsync   stream  tcp     nowait  root    /usr/bin/rsync  rsyncd --daemon

The next line needs to be added to /etc/services:

        rsync   tcp/873

Note that you have to make sure that TCP port 873 is enabled on the internal (software) firewall! You can find the Mac OS X firewall configuration in your System Preferences, Internet icon.

After you have modified the files and the firewall, you have to tell the Internet "super-server" (inetd) to re-read its configuration files. You can do this from the Terminal application:

[machine-name:~] fcadmin% ps -ax | grep inetd
 418  ??  Ss     0:00.02 inetd
3040 std  R+     0:00.00 grep inetd
[machine-name:~] fcadmin% sudo kill -1 418
Password:
[machine-name:~] fcadmin%

Your system is now ready to receive connection requests to rsync.

The next step is to create a folder on your system that you want to make available to rsync. For example, this could be a folder called /Users/fcadmin/Backup, assuming you have a user called "fcadmin" on your system. It's a good idea to determine this user's user ID and group ID while we are at it. We will use this information in our last step, the configuration of the rsync.conf file. You can do this by executing the following command from the Terminal application:

[machine-name:~] fcadmin% id
uid=502(fcadmin) gid=20(staff) groups=20(staff), 80(admin)
[machine-name:~] fcadmin%

In the above example, the user ID is 502 and the group ID 20.

Now we need to create the rsyncd.conf file. This file needs to be created in the /etc folder and therefore you will again require admin-level access, either by using the "root" user, or the "sudo" command. You need to use a text-only editor, like vi. The contents of the file looks similar to this:

use chroot = yes
log file = /Users/fcadmin/FCBackup/rsync.log
uid = fcadmin
gid = admin

[backup]
       path = /Users/fcadmin/FCBackup
       comment = FirstClass Automated Backup Area
       read only = false
       hosts allow = 172.31.1.156

This file will create an rsync "module", called "backup". A log file is maintained and all access will be performed with user ID fcadmin and group ID admin. Only the machine with IP address 172.31.1.156 is allowed to connect to this module. After the file is saved and closed, you can connect to this server with the following command:

[machine-name:~] fcadmin% rsync hostname::
backup          FirstClass Automated Backup Area
[machine-name:~] fcadmin%

The output is the module name, followed by the comment as defined in the rsync.conf file. You are now nearly ready to use the fcbackup.sh script. First we need to create the appropriate folder structure. Unfortunately fcbackup.sh can not create these folders automatically. Therefore you will have to create the following folders manually on your rsync server:

For weekly backup periods:

Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday

For monthly backup periods:

Day01
Day02
Day03
...
Day30
Day31

Note that the folder names are case-sensitive and that they need to be created inside the backup folder specified in the rsync.conf file, which is in our example /Users/fcadmin/FCBackup.

That was the last step that needed to be completed. Now you can start the backup script as follows:

[machine-name:~] fcadmin% ./fcbackup.sh apps hostname::backup
09Feb04 16:36:11 - (Info) FirstClass Automated Backup 1.0-7 (Darwin) Started
09Feb04 16:36:11 - (Info) Backing up FirstClass Application folder '/Library/FirstClass Server'
09Feb04 16:36:11 - (Verbose) Synchronizing Data...
09Feb04 16:36:12 - (Warning) Connecting to remote rsync server
09Feb04 16:36:12 - (Verbose) Preserving all file attributes
09Feb04 16:36:12 - (Verbose) Copying from: /Library/FirstClass Server
09Feb04 16:36:12 - (Verbose) Copying to: hostname::backup/Monday
09Feb04 16:36:12 - (Verbose) Excluding: Volumes/

Number of files: 156
Number of files transferred: 142
Total file size: 18641453 bytes
Total transferred file size: 18641453 bytes
Literal data: 18641453 bytes
Matched data: 0 bytes
File list size: 3450
Total bytes written: 18652855
Total bytes read: 2312

wrote 18652855 bytes  read 2312 bytes  7462066.80 bytes/sec
total size is 18641453  speedup is 1.00
09Feb04 16:36:14 - (Verbose) Data Synchronized in 0:00:03
09Feb04 16:36:14 - (Info) FirstClass Automated Backup 1.0-7 (Darwin) Finished
[machine-name:~] fcadmin%

You can use an alternative syntax for the destination, which is the rsync:// URL syntax:

[machine-name:~] fcadmin% ./fcbackup.sh apps rsync://hostname/backup

Return to Contents