Skip to content

Commit

Permalink
Merge pull request #6710 from vojtapolasek/fix_ensure_logrotate_activ…
Browse files Browse the repository at this point in the history
…ated_remediation

fix remediations of ensure_logrotate_activated
  • Loading branch information
yuumasato committed Mar 17, 2021
2 parents 9bbca5e + d7e3988 commit ddaad85
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Expand Up @@ -15,7 +15,7 @@
lineinfile:
create: no
dest: "/etc/logrotate.conf"
regexp: "^(weekly|monthly|yearly)$"
regexp: '^[\s]*(weekly|monthly|yearly)$'
state: absent

- name: Configure cron.daily if not already
Expand Down
Expand Up @@ -7,7 +7,7 @@ CRON_DAILY_LOGROTATE_FILE="/etc/cron.daily/logrotate"
grep -q "^daily$" $LOGROTATE_CONF_FILE|| echo "daily" >> $LOGROTATE_CONF_FILE

# remove any line configuring weekly, monthly or yearly rotation
sed -i -r "/^(weekly|monthly|yearly)$/d" $LOGROTATE_CONF_FILE
sed -i '/^\s*\(weekly\|monthly\|yearly\).*$/d' $LOGROTATE_CONF_FILE

# configure cron.daily if not already
if ! grep -q "^[[:space:]]*/usr/sbin/logrotate[[:alnum:][:blank:][:punct:]]*$LOGROTATE_CONF_FILE$" $CRON_DAILY_LOGROTATE_FILE; then
Expand Down
@@ -1,6 +1,6 @@
#!/bin/bash

# fix logrotate config
sed -i "s/weekly/daily/" /etc/logrotate.conf
sed -i "s/\(weekly\|monthly\|yearly\)/daily/" /etc/logrotate.conf

# default for cron.daily for RHEL7 is already correct

0 comments on commit ddaad85

Please sign in to comment.