summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2022-11-16 05:15:45 +0100
committerGitHub <noreply@github.com>2022-11-16 05:15:45 +0100
commita221745a404ffa1a9232a4f58351d724103be398 (patch)
tree171e5820dd5629601e5467404a5042a639c51d6c /tools
parentMerge pull request #12291 from anlancs/pimd/mtrace-fd (diff)
parentpackaging: Reuse frr.logrotate for Debian and Redhat builds (diff)
downloadfrr-a221745a404ffa1a9232a4f58351d724103be398.tar.xz
frr-a221745a404ffa1a9232a4f58351d724103be398.zip
Merge pull request #11058 from opensourcerouting/fix/redhat_debian_logrotate
packaging: Reuse frr.logrotate for Debian and Redhat builds
Diffstat (limited to 'tools')
-rw-r--r--tools/etc/logrotate.d/frr27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/etc/logrotate.d/frr b/tools/etc/logrotate.d/frr
new file mode 100644
index 000000000..735af6539
--- /dev/null
+++ b/tools/etc/logrotate.d/frr
@@ -0,0 +1,27 @@
+/var/log/frr/*.log {
+ size 500k
+ sharedscripts
+ missingok
+ compress
+ rotate 14
+ create 0640 frr frr
+
+ postrotate
+ pid=$(lsof -t -a -c /syslog/ /var/log/frr/* 2>/dev/null)
+ if [ -n "$pid" ]
+ then # using syslog
+ kill -HUP $pid
+ fi
+ # in case using file logging; if switching back and forth
+ # between file and syslog, rsyslogd might still have file
+ # open, as well as the daemons, so always signal the daemons.
+ # It's safe, a NOP if (only) syslog is being used.
+ for i in babeld bgpd eigrpd isisd ldpd nhrpd ospf6d ospfd sharpd \
+ pimd pim6d ripd ripngd zebra pathd pbrd staticd bfdd fabricd vrrpd; do
+ if [ -e /var/run/frr/$i.pid ] ; then
+ pids="$pids $(cat /var/run/frr/$i.pid)"
+ fi
+ done
+ [ -n "$pids" ] && kill -USR1 $pids || true
+ endscript
+}