Created attachment 438092 [details, diff] Patch to add rotate option to the dnsmasq init script When using dnsmasq with the log-facility=/file option there is no trivial way of rotating the log file. The /etc/init.d/dnsmasq reload command sends a HUP signal, but that does not reopen the log files. For that the USR2 signal is needed. So I'd like to do something like this in logrotate.d: /var/log/dnsmasq.log { create 640 dnsmasq root notifempty postrotate /etc/init.d/dnsmasq --quiet --ifstarted rotate endscript } Attached is a patch to add the rotate option to the dnsmasq initscript. First I tried to add it to /etc/conf.d/dnsmasq, but unfortunately that doesn't work.
Instead of modifying the the init.d script, you can use the following logrotate config to have dnsmasq reopen the log file after rotation. /var/log/dnsmasq.log { compress delaycompress missingok monthly nomail noolddir notifempty rotate 3 sharedscripts create 0640 dnsmasq root postrotate [ ! -f /var/run/dnsmasq.pid ] || kill -USR2 $(cat /var/run/dnsmasq.pid) endscript }
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36950876fc0da1b5ced6a6c58508f5bc2c8be572 commit 36950876fc0da1b5ced6a6c58508f5bc2c8be572 Author: Patrick McLean <chutzpah@gentoo.org> AuthorDate: 2018-03-19 18:10:03 +0000 Commit: Patrick McLean <chutzpah@gentoo.org> CommitDate: 2018-03-19 18:11:38 +0000 net-dns/dnsmasq: Version bump to 2.79 Closes: https://bugs.gentoo.org/586454 Closes: https://bugs.gentoo.org/633496 Closes: https://bugs.gentoo.org/643670 Gentoo-Bug: https://bugs.gentoo.org/645704 Package-Manager: Portage-2.3.24, Repoman-2.3.6 net-dns/dnsmasq/Manifest | 1 + net-dns/dnsmasq/dnsmasq-2.79.ebuild | 198 +++++++++++++++++++++++++++++ net-dns/dnsmasq/files/dnsmasq-init-dhcp-r3 | 35 +++++ net-dns/dnsmasq/files/dnsmasq-init-r4 | 29 +++++ net-dns/dnsmasq/files/dnsmasq.logrotate | 7 + 5 files changed, 270 insertions(+)