Last updated 2013/03/16
Return to the Suffield Academy Network Documentation Homepage
A printable version of this document is also available.
Suffield Academy uses FirstClass 11 as it's e-mail server. We currently run it on virtualized Debian Linux servers, which has improved stability and configurability from OS X.
First Class 8 (FC8) and above supports the ability to script certain actions via the command line (start, stop, restart, mirror pause, etc). Additionally, the standard control scripts support additional hooks for custom behaviors when the scripts are run.
Suffield uses both of these features to add custom behaviors to our FC server. We use the scripting to execute regular unattended backups of the First Class Network Store, and we use the script hooks for automatic maintenance tasks (such as log rotation).
A few "hints" about running FC on our servers (that doesn't really go anywhere else):
-ip XXX.XXX.XXX.XXX
to tell the server what its
IP address is. You put this on the ./SERVICE_APP
line in
/etc/init.d/fcisd
. Note that this customization may be
overwritten when you upgrade FCIS!*
rinetd
. The rinetd.conf
line looks like (substitute your
IP address for XXX):*
127.0.0.1 25 XXX.XXX.XXX.XXX 25
FC has hooks to execute pre- and post-flight shell scripts whenever
the user invokes the standard server control scripts fcsctl
or
fcisctl
. Preflight scripts execute before the standard command
would execute (and thus can affect whether the command even runs),
while postflight scripts run after the daemon has completed its
action. Thus, these control scripts look in a specific location for
files called prefcsd
and prefcisd
, or postfcsd
and
postfcisd
(depending on pre/post and daemon). If they are
found, the control scripts call them using the same arguments passed
to the control script.
We have written a set of generic hook scripts, which can be used to call other scripts as needed. This additional layer of abstraction helps to find and diagnose problems, and also consolidates common code in external scripts.
The hook scripts are called directly by the FC control
scripts. They must have a specific name, and reside in a specific
location, in order for FC to find and execute them. See the
/etc/init.d/fcsd
and /etc/init.d/fcisd
scripts and search for
the USERDOCS variable. In our case, we redefined it to a more central location:
USERDOCS="/opt/fcsd/suffield_prepost"
The scripts are named after the daemon (fcsd
or fcisd
) and
whether they're "pre" or "post" scripts. Thus, there are four
scripts:
prefcsd
,
prefcisd
,
postfcsd
,
and postfcisd
.
They are all downloadable from our
scripts
directory.
They're basically big case statements that figure out what action to take, and then they call another script to do the heavy lifting (log rotation, etc.).
FirstClass has a built-in mirroring capability that allows for a "warm" backup of the FirstClass system to exist at all times. The mirror replicates the FirstClass Network Store (FCNS) in near-real time to another drive. When you wish to backup the server, you can "pause" the mirror and back it up so you have a consistent backup.
Recently, we found that the mirror is unable to keep up with the traffic on the FCNS. If we paused the mirror to back up, and the backup took several hours, the mirror might not catch up before the next backup was due to begin. We've now moved to a system where we take a read-only snapshot of the FCNS (using Linux's LVM), and then back that up at our leisure.
The previous version of our backup script, called
fcnsbackup
is
available for historical purposes, but is not maintained.
The current version of the script is called
rsync_snapshot_fcns
.
It is well-commented and follows this basic procedure: