As with any application, it is important to ensure that backups are performed regularly. PaperCut NG includes a built-in backup process that saves the state of the database to a file. The in-built backup functionality is designed to complement (not replace) a good system-wide backup policy and procedure. The backup is stored in the industry standard XML format that is compressed using the standard ZIP format to reduce disk-space on the server and your backup medium. The use of these open standards ensures that your data is always available and accessible.
PaperCut NG makes the process of managing backups simple by automatically performing a weekly backup. The backup file is in the following directory:
[app-path]\server\data\backups
The weekly backups are performed at 20 minutes past midnight on Sunday morning (or as otherwise defined by the schedule.weekly
config key.
Please see the section called “Using the Config Editor” to find out how to change config keys.)
In accordance with backup best practice, the above directory should be regularly backed-up
to offline media (e.g. tape, CD or remote server). This will allow the data to be restored in the case
the server hard-drive is corrupted. An example backup script called
copy-backups-to-remote-server.bat
found at
[app-path]/server/examples/scripting/batch/
may help administrators automate the process
of maintaining an off-disk copy.
On larger networks, it may be desirable to perform backups more frequently than the in-built once a week period.
The server-command
tool may be used to execute the backup task at other times.
Simply write a script (e.g. batch file) to execute server-command perform-online-backup
.
Schedule the script to run at the desired intervals. More information on server-command
is available in the section called “Server Commands (server-command)”.
In addition to the automated weekly backups, it is also possible to manually initiate a backup. This might be useful to back up the system before performing an upgrade. To perform a manual backup:
Navigate to the
→ page.Press the
button.A window will open showing the backup progress and the location where the backup file is saved.
There are a number of situations when it might be necessary to restore a database, including:
Hardware or system failure requires you to rebuild the server and reinstall PaperCut NG.
A new print server was purchased and PaperCut NG is being moved to a new server.
To import data into an external RDBMS (See Chapter 19, Deployment on an External Database (RDBMS)).
To restore from a backup:
Locate a previous backup file.
Shutdown the application server (See the section called “Stopping and Starting the Application Server”). The database cannot be in-use when performing the restore, so the application server needs to be stopped first.
Open a command prompt. Change to the server binaries directory. On a Windows system the
directory location is [app-path]\server\bin\win\
.
Re-initialize the database back to an empty state by typing the following:
db-tools init-db -f
Run the import process by executing the following:
db-tools import-db -f "C:\path\to\backup\backup-file-name.zip"
(Or, ./db-tools
on some systems. See the section called “Database Tool (db-tools)” for
more information on using db-tools
) NOTE: On Mac/Linux ensure proper permissions
for access to the file, e.g.
chown papercut:admin \path\to\backup\backup-file-name.zip
The import will ask whether the existing database data should be deleted before proceeding.
Once the import has completed, restart the application server (See the section called “Stopping and Starting the Application Server”).
Performing an online backup (as discussed above) is a simple and convenient process, but it is sometimes necessary to perform an offline backup. For example:
To integrate into your existing backup procedures, it might be necessary to write a script or batch file to perform a backup at a known point in time.
When it is necessary to guarantee that the backup captures all the data. When performing an online backup the system is still in use so data could be modified after the backup completes.
To perform an offline backup:
Stop the application server (See the section called “Stopping and Starting the Application Server”). To ensure all data is captured, the application server must be stopped to perform an offline backup.
Open a command prompt. On a Windows system change to the following directory: [app-path]\server\bin\win\
Run the database export process by executing:
db-tools export-db
(This will create a backup file in the system backups directory and the filename named with a timestamp).
The export command has additional options that allows you to specify a different directory or filename. See the section called “export-db Command” for more details.
Backup files in
[app-path]\server\data\backups
will be retained for 30 days and then deleted. This number of days can be changed on the
→ page under "Keep backups for ... days". This period will automatically be extended should backups not be performed on a regular basis, i.e. when automatic backup have been temporarily disabled for a time or when skipping scheduled backups due to a system outage. Older backups files will not be deleted unless a number of new backups have been performed. At the very least the latest backup file will always be retained regardless of its age.© Copyright 1999-2011. PaperCut Software International Pty Ltd. All rights reserved.