summaryrefslogtreecommitdiffstats
path: root/debian/frr.logrotate
blob: 735af6539b267502cee8ff870bc74475704d3b0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
}