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
parent
16a06d7637
commit
517895f69d
|
@ -12,10 +12,13 @@ gen_action() {
|
||||||
changed=false
|
changed=false
|
||||||
if [ -n "${interface}" ] && [ -d /run/rsyslog.d ]; then
|
if [ -n "${interface}" ] && [ -d /run/rsyslog.d ]; then
|
||||||
if [ -n "${new_log_servers}" ]; then
|
if [ -n "${new_log_servers}" ]; then
|
||||||
echo '# Generated by dhcpcd' > /run/rsyslog.d/dhcpcd."${interface}".conf
|
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
|
for s in ${new_log_servers}; do
|
||||||
gen_action "${s}" >> /run/rsyslog.d/dhcpcd."${interface}".conf
|
gen_action "${s}" >> /run/rsyslog.d/dhcpcd."${interface}".conf
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
changed=true
|
changed=true
|
||||||
elif [ -n "${old_log_servers}" ]; then
|
elif [ -n "${old_log_servers}" ]; then
|
||||||
rm -f /run/rsyslog.d/dhcpcd."${interface}".conf
|
rm -f /run/rsyslog.d/dhcpcd."${interface}".conf
|
||||||
|
|
Reference in New Issue