dustin
/
jenkinsagent
Archived
1
0
Fork 0

rootfs: Avoid unnecessarily restarting rsyslog

When the DHCP lease is renewed, if the specified log servers are the
same as the previous lease, there is no reason to regenerate the
*rsyslog* configuration file and restart the service.
master
Dustin 2022-03-17 10:26:45 -05:00
parent 16a06d7637
commit 517895f69d
1 changed files with 7 additions and 4 deletions

View File

@ -12,10 +12,13 @@ gen_action() {
changed=false
if [ -n "${interface}" ] && [ -d /run/rsyslog.d ]; then
if [ -n "${new_log_servers}" ]; then
echo '# Generated by dhcpcd' > /run/rsyslog.d/dhcpcd."${interface}".conf
for s in ${new_log_servers}; do
gen_action "${s}" >> /run/rsyslog.d/dhcpcd."${interface}".conf
done
if [ "${new_log_servers}" != "${old_log_servers}" ]; then
echo '# Generated by dhcpcd' \
> /run/rsyslog.d/dhcpcd."${interface}".conf
for s in ${new_log_servers}; do
gen_action "${s}" >> /run/rsyslog.d/dhcpcd."${interface}".conf
done
fi
changed=true
elif [ -n "${old_log_servers}" ]; then
rm -f /run/rsyslog.d/dhcpcd."${interface}".conf