Am 29.01.2017 um 16:12 schrieb Simen Thoresen via Users:
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.

That's all the wrong approach on CentOS 7. It is systemd based and thus a service has to be controlled by a unit file, not a SysV init script.

And to make sure network is up for a network dependent service systemd provides a mechanism: network-online.target.

[Unit]
Wants=network-online.target
After=network-online.target

Alexander

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

Reply via email to