Manage system backups
As with any application, it is important to ensure that backups are performed regularly. PaperCut NG includes a built-in database export that saves the state of the database to a file. This functionality is designed to complement (not replace) a good system-wide backup process. The export is stored in the industry standard XML format and 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.
As PaperCut is centrally managed, the only database that requires backup is on the Application ServerAn Application Server is the primary server program responsible for providing the PaperCut user interface, storing data, and providing services to users. PaperCut uses the Application Server to manage user and account information, manage printers, calculate print costs, provide a web browser interface to administrators and end users, and much more.. Secondary print servers and Site Servers do not require a database backup.
PaperCut NG makes the process of managing export backups simple by automatically performing a weekly export. Export backup files are placed in the following directory:
The weekly exports are performed at 20 minutes past midnight on Sunday morning (or as otherwise defined by the schedule.weekly config keyA config key stores information about a specific advanced setting in PaperCut. Config keys are editable by an administrator in the Config Editor.. See Using the Config Editor to find out how to change config keys.)
In accordance with backup best practice, back up the above directory regularly to offline media (e.g. tape, CD or remote server). This allows 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/ can help administrators automate the process of maintaining an off-disk copy.
On larger networks, you might want to perform export backups more frequently than the in-built once a week period. Use the server-command tool to execute the export 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 Server commands (server-command).
Performing an online backup
In addition to the automated weekly exports, it is also possible to manually initiate a database export. This might be useful to back up the system database before performing an upgrade. To perform a manual export:
Select Options > Backups.
The Backups page is displayed.
Click Export Now.
A window is displayed showing the export progress and the location where the export file is saved.
Restoring an export backup
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 serverA print server is a system responsible for hosting print queues and sharing printer resources to desktops. Users submit print jobs to a print server rather then directly to the printer itself. A print server can be a dedicated server but on many networks this server also performs other tasks, such as file serving was purchased and PaperCut NG is being moved to a new server.
To import data into an external RDBMSA Relational database management system (RDBMS) is a program that lets you create, update, and administer a relational database. Most commercial RDBMS's use the Structured Query Language (SQL) to access the database, although SQL was invented after the development of the relational model and is not necessary for its use. (See Deployment on an external database (RDBMS)).
To restore from an export file:
Locate a previous export file.
Shutdown the Application Server (See Stop and start 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. On Windows 7 and Server 2008 systems, this might need to be specifically elevated to run with administrator privileges, even if you are already logged in with an administrator account. Change to the server binaries directory. On a Windows system the directory location is [app-path]\server\bin\win\.Tip:
You must run the command prompt as an Administrator. In the Windows Start menu, right-click Command Prompt; then select Run as administrator.
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 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 asks if the existing database data should be deleted before proceeding.
Once the import has completed, restart the Application Server (See Stop and start the Application Server).
Performing an offline backup
Performing an online backup (as discussed above) is a simple and convenient process, but it is sometimes necessary to perform a backup when the Application Server is not running. 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. Performing an online export while the system is in use can modify data after the export is complete.
To perform an offline backup:
Stop the Application Server (See Stop and start 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:
(This create an export 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 export-db Command for more details.
Export file retention
Export files in
are retained for 30 days and then deleted. You can change the number of days on the Options > Backups page under "Keep exports for ... days". This period is automatically extended should exports not be performed on a regular basis, i.e. when automatic exports have been temporarily disabled for a time or when skipping scheduled exports due to a system outage. Older export files are not deleted unless a number of new exports have been performed. At the very least the latest export file is always retained regardless of its age.
Backup print archive files
By default the print archive is stored in
It is not included in the database exports detailed above. It is recommended that you consider backing up part or all of the print archive with your existing backup processes. As PaperCut is resilient to partial restoration of the Print Archive you might want to backup only a month or two worth of archives. There is a README.txt in the archive directory that explains more about partial backups and the directory structure layout.