Hello, After many hours of research, I made a small solution:
1. Created a file in /etc/systemd/system/policyd.service with the content: [Unit] Description=Policyd After=network.target After=syslog.target After=mysqld.service Before=postfix.service Requires=mysqld.service [Install] WantedBy=multi-user.target [Service] User=policyd Group=policyd Type=forking ExecStart=/etc/init.d/cbpolicyd Restart=on-failure TimeoutSec=60 Restart=always 2. Changed the owner of the log file: chown policyd:policyd /var/log/policyd.log 3. Enabled the policyd service systemctl enable policyd.service Works fine now. Atenciosamente, Diogo Braga 2017-01-29 15:24 GMT-02:00 Alexander Dalloz via Users < users@lists.policyd.org>: > 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 > Users@lists.policyd.org > http://lists.policyd.org/mailman/listinfo/users_lists.policyd.org >
_______________________________________________ Users mailing list Users@lists.policyd.org http://lists.policyd.org/mailman/listinfo/users_lists.policyd.org