我正在尝试安装PolicyD v2,但是当从sql文件创建sqlite3数据库时会抛出错误:
SQLite version 3.7.17 2013-05-20 00:56:22
sqlite> .read /usr/doc/policyd2-2.0.14/policyd2.sqlite
Error: near line 1: unrecognized token: "#"
Error: near line 43: no such table: policies
Error: near line 44: no such table: policies
Error: near line 45: no such table: policies
Error: near line 46: no such table: policies
Error: near line 47: no such table: policies
Error: near line 174: unrecognized token: "#"
Error: near line 215: unrecognized token: "#"
Error: near line 263: no such table: quotas
Error: near line 264: no such table: quotas
Error: near line 303: unrecognized token: "#"
Error: near line 447: no such table: amavis_rules
Error: near line 462: unrecognized token: "#"
Error: near line 570: unrecognized token: "#"
Error: near line 617: unrecognized token: "#"
/usr/doc/policyd2-2.0.14/policyd2.sqlite看起来像这样:
line:1 # Core schema
line:2 # Copyright (C) 2009, AllWorldIT
line:3 # Copyright (C) 2008, LinuxRulz
...
/* Policies */
CREATE TABLE policies (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
Name VARCHAR(255) NOT NULL,
Priority SMALLINT NOT NULL,
Description TEXT,
Disabled SMALLINT NOT NULL DEFAULT '0'
) ;
...
line:43 INSERT INTO policies (Name,Priority,Description) VALUES ('Default',0,'Default System Policy');
line:44 INSERT INTO policies (Name,Priority,Description) VALUES ('Default Outbound',10,'Default Outbound System Policy');
line:45 INSERT INTO policies (Name,Priority,Description) VALUES ('Default Inbound',10,'Default Inbound System Policy');
line:46 INSERT INTO policies (Name,Priority,Description) VALUES ('Default Internal',20,'Default Internal System Policy');
line:47 INSERT INTO policies (Name,Priority,Description) VALUES ('Test',50,'Test policy');
创建表格:
sqlite> .tables
checkhelo_blacklist policy_group_members
checkhelo_tracking policy_groups
checkhelo_whitelist policy_members
greylisting_autoblacklist quotas_limits
greylisting_autowhitelist quotas_tracking
greylisting_tracking session_tracking
greylisting_whitelist
我可以手工制作'政策','配额','amavis_rules'表格。
这里有什么问题?其他表格已经创建。
答案 0 :(得分:0)
它是由控制台和文件中的一些格式错误(编码/解码)字符引起的,如tab,space,new line。
解决方法是使用grep。
recent-flights