# ncid logrotate file
# Last modified: Feb 10, 2019

/var/log/cidcall.log /var/log/ciddata.log {
    include /etc/ncid/rotatebysize.conf
    monthly
    rotate 5
    missingok
    notifempty
    sharedscripts
    prerotate
        [ -x /usr/share/ncid/sys/ncidrotate ] && \
            /usr/share/ncid/sys/ncidrotate prerotate
        true
    endscript
    postrotate
        [ -x /usr/share/ncid/sys/ncidrotate ] && \
            /usr/share/ncid/sys/ncidrotate postrotate
        true
    endscript
}

/var/log/*ncid.log {
    monthly
    rotate 5
    missingok
    notifempty
    sharedscripts
    postrotate
        for i in $*; do
            n=`basename $i .log`
            if [ -f /usr/lib/systemd/system/$n.service ]
            then systemctl condrestart $n.service
            elif [ -x /etc/init.d/$n ]
            then /etc/init.d/$n condrestart
            fi
        done
        true
    endscript
}
