Skip to content

Commit

Permalink
Make sure logrotate send rsyslog HUP signal only if it is already run…
Browse files Browse the repository at this point in the history
…ning (#19947)

#### Why I did it
We encounter an error in the log, which came from the call to logrotate while rsyslog is not running.

### How I did it
Config logrotate to check that the HUP signal will only send when rsyslog is running.
  • Loading branch information
DavidZagury authored Sep 28, 2024
1 parent 4d94ed5 commit d207484
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions files/image_config/logrotate/rsyslog.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
delaycompress
sharedscripts
postrotate
/bin/kill -HUP $(cat /var/run/rsyslogd.pid)
if [ -f /var/run/rsyslogd.pid ]; then
/bin/kill -HUP $(cat /var/run/rsyslogd.pid)
fi
endscript
}

Expand Down Expand Up @@ -116,7 +118,9 @@
pgrep -x orchagent | xargs /bin/kill -HUP 2>/dev/null || true
fi
else
/bin/kill -HUP $(cat /var/run/rsyslogd.pid)
if [ -f /var/run/rsyslogd.pid ]; then
/bin/kill -HUP $(cat /var/run/rsyslogd.pid)
fi
fi
endscript
}

0 comments on commit d207484

Please sign in to comment.