0

I have HA cluster with samba running on the active node, now i get these error's in my root mail:

Can't find pid for destination 'smbd'
error: error running non-shared postrotate script for /var/log/samba/log.smbd of '/var/log/samba/log.smbd '
Can't find pid for destination 'nmbd'
error: error running non-shared postrotate script for /var/log/samba/log.nmbd of '/var/log/samba/log.nmbd '
run-parts: /etc/cron.daily/logrotate exited with return code 1

Can i make Logrotate only restart the service if it was running ?

As requested the logrotate config of smane

/var/log/samba/log.smbd {
        weekly
        missingok
        rotate 7
        postrotate
                [ ! -x /usr/bin/smbcontrol ] || /usr/bin/smbcontrol smbd reload-config
        endscript
        compress
        delaycompress
        notifempty
}

/var/log/samba/log.nmbd {
        weekly
        missingok
        rotate 7
        postrotate
                [ ! -x /usr/bin/smbcontrol ] || /usr/bin/smbcontrol nmbd reload-config
        endscript
        compress
        delaycompress
        notifempty
}

/var/log/samba/log.samba {
        weekly
        missingok
        rotate 7
        postrotate
                if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet samba-ad-dc; then
                        systemctl kill --kill-who all --signal=SIGHUP samba-ad-dc
                elif [ -f /var/run/samba/samba.pid ]; then
                        # This only sends to main pid, See #803924
                        kill -HUP `cat /var/run/samba/samba.pid`
                fi
        endscript
        compress
        delaycompress
        notifempty
}
2
  • Show your samba logrotate config & postrotate script. Best guess is to edit postrotate script so it doesn't returns an error if pid not found
    – NStorm
    May 3, 2020 at 19:00
  • @NStorm as requested May 4, 2020 at 20:20

1 Answer 1

0

Now based on your logrotate config I can see where those errors come from. They are from smbcontrol tool which returns an error code if it can't find smbd/nbmd PID.

Here is a simple solution to ignore those errors on log rotation scripts: add || true after /usr/bin/smbcontrol [sn]mbd reload-config lines. I.e. first part should look like

postrotate [ ! -x /usr/bin/smbcontrol ] || /usr/bin/smbcontrol smbd reload-config || true endscript

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .