此工具提供了各种PaperCut NG数据库和数据操作的功能。命令的语法是:
db-tools command [options]
有效的命令是:
export-db - 导出/备份数据库的数据
import-db - 导入/存储数据库的数据
init-db - 创建表格并初始化新数据库里的数据
delete-old-logs -
删除旧的日志数据(交易,打印,应用程序日志等)
db-tools is a command-line application accessed via the Command Prompt on Windows, or a
Command Shell (e.g. bash or a terminal) on Linux and Mac. On Linux or Mac the command must be run as the
papercut user. Example use on the Apple Mac:
sudo su - papercut
db-tools import-db -f /Users/bob/papercut-backup.zip
db-tools needs exclusive access to the database. It is important that any PaperCut NG services
and processes are stopped before executing any commands. Failure to do so will result in a "database in use" error message.
The db-tools command is a powerful low-level utility and its use on a production system should be carefully
considered. The available commands are discussed in detail below.
导出数据库命令是指从数据库导出数据。应用程序服务器必须在导出执行之前被终止。对于export-db命令的语法和选项是:
usage: db-tools export-db [options]
-d,--dir <dir> Exports the database to the given directory.
-f,--file <file> Exports the database to the given file.
-h,--help Displays this help.
如果没有指定的选项那么数据库导出文件是在[appdir]\server\data\backups目录里创建的并且文件被命名为 export-[date-time].zip。
The --dir 选项通常使用默认的备份目录。文件名将仍被命名为 export-[date-time].zip
The --file 选项通常指定全部的路径和备份所保存的文件名的位置。
如果目录或文件名的参数包含有空间,那么参数需要被配额。
import-db命令导入数据(从先前导出的)到数据库。应用程序服务器必须在执行导入前被终止。对于import-db 命令的语法和选项是:
usage: db-tools import-db [options] import-file
-f,--force Deletes any existing data before loading the data.
-h,--help Displays this help.
--force 选项必需在数据被载入到数据库时就已经包含数据了。在此情况下,强制选项表明了现有的数据将被首先删除。
如果导入的文件包含了此参数的空间那么此参数将必须被配额。
init-db命令是指初始化一个数据库,创建所需要的表格和原始的数据。应用程序服务器必须在初始化数据库之前被终止。对于init-db命令的语法和选项是:
usage: db-tools init-db [options]
-f,--force Re-initializes the database even if it already exists.
-h,--help Displays this help.
The--force选项是需要初始化数据库的,并且数据库中已经包含了表格和数据。在此情况下,强制选项将在重新创建表格之前终止现有的表格。
删除旧的日志通常是从系统中删除旧的日志数据,此命令将永久性的删除系统中的以下数据:
打印机的使用日志 - 记录和统计着所有打印的历史记录
Internet的使用日志 - 记录所有用户Internet的使用情况
帐户的交易日志 - 记录了用户对共享帐户的所有调整情况
应用日志 - 记录了应用状态和所出现的错误信息
usage: db-tools delete-old-logs [options] delete-older-than-days
-n,--non-interactive Perform deletion without confirmation.
-h,--help Displays this help.
未联机的选项将执行未经确认的用户的删除。此操作有利于通过指派的任务或任务图标进行自动删除。
删除旧的日志的日期选项决定了将在删除哪个日期的日志。如果删除旧的日志的日期为90,那么所有在90天以前的日志都将被删除。