GreenArrow Email Software Documentation

Unmanaged Backups

If you don’t wish to use GreenArrow’s managed backup service, or would like to maintain an independent backup of your data, the example backup script below can be used.

This script creates backup files in the directory that you specify, or /var/backup/ by default. Please verify that you have enough disk space available in that directory before running this script. Backups will usually occupy less space than the value returned by the following command:

du -Lhs /var/hvmail

Backup Script

GreenArrow Engine comes with an unmanaged backup script. It can be found at /var/hvmail/bin/hvmail_unmanged_backup.

Interface

/var/hvmail/bin/hvmail_unmanged_backup does the following:

  • Accepts one command-line argument: the directory to write the backup to. The backup is written as multiple files in this directory. The directory is created if it does not exist.

  • Writes out multiple files in the destination directory, which together comprise a backup of the configuration and data of the GreenArrow installation. Log files, messages queues, and temporary files are not included in the backup.

  • Prints out a log of the actions taken.

  • Returns 0 on success and non-zero on failure.

Example Use

  1. Add the following entry to root’s crontab, replacing [email protected] with your email address and /var/backup/greenarrow with the directory that you wish to save the backup to:

    # GreenArrow unmanaged backups
    1 23 * * *  /var/hvmail/bin/hvmail_unmanged_backup /var/backup/greenarrow 2>&1 | /var/hvmail/bin/mailsubj 'GreenArrow Unmanaged Backup Report' [email protected]
    

  2. After this script runs, you should receive an email with a subject of GreenArrow Unmanaged Backup Report. Check this email for errors, and verify that backup files were created in the directory that you specified. Here’s an example email generated by a backup that completed without error:

    Backing up the local GreenArrow installation to /var/backup/greenarrow...
    Backing up PostgreSQL...
    ...done.
    Backing up GreenArrow's data files...
    ...done.
    The backup is finished. No errors were detected.
    

    The backup script’s last line of output and return code can be used to determine whether any errors were detected:

    • If no errors were detected, the backup script will have a return code of 0, and its last line of output will read The backup is finished. No errors were detected.

    • If any errors were detected, the backup script will have a return code other than 0, and its last line of output will read The backup is finished. Error(s) were detected. See above.

    The backup script will output the following text immediately after each error that it detects:

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    There was an error running backups. Please review the above output for
    details and contact GreenArrow technical support if you have any questions.
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    

    A copy of the emailed backup report is also saved to the greenarrow-backup.log file within the directory that files were backed up to (/var/backup by default or /var/backup/greenarrow in this example).

  3. Arrange for the backups to be regularly copied to an external server or device so that if the hard drive that backups are saved to dies, you don’t lose the backups. We strongly recommend that you use a versioning system at the destination so that if there are any issues with the most recent backup or data needs to be recovered which was deleted before to the most recent backup being taken, you can restore from a previous backup.

Output

The unmanaged backup script creates the following files:

File Description Required for Restore
greenarrow.dump A pg_dump custom-format dump (suitable for input into pg_restore) of GreenArrow’s PostgreSQL database. Yes
postgres.dump A pg_dump custom-format dump (suitable for input into pg_restore) of PostgreSQL’s “postgres” database Yes
postgresql-globals.psql A PostgreSQL dump (suitable for input into psql) of PostgreSQL’s roles and tablespaces Yes
greenarrow-files.tar.gz A tarball (archive) of GreenArrow’s files Yes
greenarrow-backup.log Log file containing a record of the output generated by the backup script No
greenarrow-dereferenced-symlinks.txt Text file listing symbolic links that do not exist on a default GreenArrow installation but were present at the time that the backup was taken. These symbolic links were dereferenced by tar. No
greenarrow-packages.txt A list of GreenArrow packages that were installed at the time that the backup was taken. No
greenarrow-repository-access-key.txt The access key that’s used to access GreenArrow’s package repositories. No
greenarrow-src.tar.gz An archive of GreenArrow source code that was present at the time that the backup was taken. This file is not present on most servers. No
hvmail_reinstall_packages A script that’s used to reinstall the same version of GreenArrow packages that were installed at the time that the backup was taken. No
operating-system-files.tar.gz A tarball (archive) of operating system files which are sometimes useful to have during a restore. No
postgresql-symlink.txt If /var/hvmail/postgres/default was a symlink (it normally is), this file contains the path that it links to. No
postgresql-tablespaces.txt A list of PostgreSQL tablespaces. No

The files listed as not being required for restoration are still useful to have during the restoration process. They assist in identifying potential issues and allow for restores to be completed more quickly than they would be without these files.

Restoration

You have two options for restoring from the backups created by this page’s backup script:

  1. Contact GreenArrow technical support to request a restoration. Please note that we charge a fee for each restoration that we perform.

  2. Perform a restoration using the instructions found in our Restoring from Backups page. The procedure described on that page has many prerequisites, including that an experienced Linux systems administrator performs the procedure. See the document’s Prerequisites section for details.


Copyright © 2012–2024 GreenArrow Email