On 1/29/2017 16:01, Diogo Braga via Users wrote:
Hello,

How to start Policyd 2.1 on CentOS 7 boot?

I used "chkconfig --level 345 cbpolicyd on" but an error occurs when
trying to connect to MySQL. If I manually call the command
"/etc/init.d/cbpolicyd start" it works fine.

Hi Diego,

While not the best solution, I've solved this on my installation with a 30s sleep added strategically in the init-script;
/etc/init.d/cbpolicyd
"
start() {
        echo -n $"Starting cbpolicyd: "
# Local hack - sleep to ensure that mysqld is online before starting
        sleep 30
        daemon /usr/sbin/cbpolicyd --config /etc/policyd/cluebringer.conf
"

If you stick some debug into this, you'll probably find that Policyd starts before some prerequisite is met, and falls over.

I've learned the above trick from a different software package which tried to reverse-resolve hostnames before the ip-interfaces came up, and we tracked this down to a bug in the RHEL 7 Systemd-build, where legacy-services that /depend/ on networking are started before networking is.
I'm vague on the details here, but try the above trick.

30s is probably overly generous on a modern system, but I think you want at least both networking and MySQL/MariaDB to be online before starting Policyd, and SystemD is not helping much here.

-S

[2017/01/29-12:43:40 - 2762] [CBPOLICYD] NOTICE: Policyd v2 /
Cluebringer - v2.1.x-201310261831
[2017/01/29-12:43:40 - 2762] [CBPOLICYD] NOTICE: Initializing system
modules.
[2017/01/29-12:43:40 - 2762] [CBPOLICYD] NOTICE: System modules initialized.
[2017/01/29-12:43:40 - 2762] [CBPOLICYD] NOTICE: Module load started...
[2017/01/29-12:43:40 - 2762] [CORE] NOTICE:   => Quotas: enabled
[2017/01/29-12:43:40 - 2762] [CORE] NOTICE:   => Protocol(Postfix): enabled
[2017/01/29-12:43:40 - 2762] [CBPOLICYD] NOTICE: Module load done.
[2017/01/29-12:43:40 - 2762] [CBPOLICYD] NOTICE: Session tracking is
ENABLED.
[2017/01/29-12:43:40 - 2762] [CBPOLICYD] DEBUG: Opening syslog,
destination = 'native', facility = 'mail'.
[2017/01/29-12:43:40 - 2762] [CORE] NOTICE: 2017/01/29-12:43:40 cbp
(type Net::Server::PreFork) starting! pid(2762)
[2017/01/29-12:43:40 - 2762] [CORE] NOTICE: Binding open file descriptors
[2017/01/29-12:43:40 - 2762] [CORE] NOTICE: Binding to TCP port 10031 on
host 127.0.0.1 with IPv4
[2017/01/29-12:43:40 - 2762] [CORE] INFO: Reassociating file descriptor
9 with TCP on [127.0.0.1]:10031, using IPv4
[2017/01/29-12:43:40 - 2762] [CORE] NOTICE: Setting gid to "5003 5003"
[2017/01/29-12:43:40 - 2762] [CORE] INFO: Setting up serialization via flock
[2017/01/29-12:43:40 - 2762] [CORE] INFO: Beginning prefork (4 processes)
[2017/01/29-12:43:40 - 2762] [CORE] INFO: Starting "4" children
[2017/01/29-12:43:40 - 3281] [CORE] DEBUG: Child Preforked (3281)
[2017/01/29-12:43:40 - 3281] [CBPOLICYD] DEBUG: Starting up caching engine
[2017/01/29-12:43:40 - 3282] [CORE] DEBUG: Child Preforked (3282)
[2017/01/29-12:43:40 - 3282] [CBPOLICYD] DEBUG: Starting up caching engine
[2017/01/29-12:43:40 - 2762] [CORE] DEBUG: Parent ready for children.
[2017/01/29-12:43:40 - 3283] [CORE] DEBUG: Child Preforked (3283)
[2017/01/29-12:43:40 - 3283] [CBPOLICYD] DEBUG: Starting up caching engine
[2017/01/29-12:43:40 - 3284] [CORE] DEBUG: Child Preforked (3284)
[2017/01/29-12:43:40 - 3284] [CBPOLICYD] DEBUG: Starting up caching engine
[2017/01/29-12:43:40 - 3281] [CBPOLICYD] WARNING: Failed to connect to
database: Error connecting to database: Can't connect to local MySQL
server through socket '/var/lib/mysql/mysql.sock' (2) (3281)
[2017/01/29-12:43:40 - 3282] [CBPOLICYD] WARNING: Failed to connect to
database: Error connecting to database: Can't connect to local MySQL
server through socket '/var/lib/mysql/mysql.sock' (2) (3282)
[2017/01/29-12:43:40 - 3283] [CBPOLICYD] WARNING: Failed to connect to
database: Error connecting to database: Can't connect to local MySQL
server through socket '/var/lib/mysql/mysql.sock' (2) (3283)
[2017/01/29-12:43:40 - 3284] [CBPOLICYD] WARNING: Failed to connect to
database: Error connecting to database: Can't connect to local MySQL
server through socket '/var/lib/mysql/mysql.sock' (2) (3284)


_______________________________________________
Users mailing list
[email protected]
http://lists.policyd.org/mailman/listinfo/users_lists.policyd.org


--
Simen Thoresen, Dolphin ICS
_______________________________________________
Users mailing list
[email protected]
http://lists.policyd.org/mailman/listinfo/users_lists.policyd.org

Reply via email to