The httpd logroate postrorate script fail to reload service with selinux enforcing mode

Solution Verified - Updated -

Issue

  • The following setting doesn't work in '/etc/logrotate.d/httpd' with selinux enforcing mode.
    postrotate
                for i in `/bin/systemctl | grep '^httpd.*.service.*loaded active running.*The Apache HTTP Server' |awk '{print$1}'`
                do /bin/systemctl reload $i > /dev/null 2>/dev/null || true
                done
        endscript
  • After disabling selinux, the above postrotate script could work.

Environment

  • Red Hat Enterprise Linux 7.4
  • systemd-219-42.el7_4.4.x86_64
  • httpd-2.4.6-67 with multiple instances
  • Each instance have its own logs file

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.