4

I have a spare system running GNU/Linux on a Raspberry Pi 2. For various reasons, I have to stop and/or disable some applications. How do I skip logrotate for stopped applications that need restarting, eg: samba, httpd:

I get the following error emailed to me.

/etc/cron.daily/logrotate:
Job for smbd.service failed. See 'systemctl status smbd.service' and 'journalctl -xn' for details.
error: error running non-shared postrotate script for /var/log/samba/log.smbd of '/var/log/samba/log.smbd '
run-parts: /etc/cron.daily/logrotate exited with return code 1

Is there a postrotate/endscript way to skip rotation if smbd and/or nmbd are not running?

1 Answer 1

3

In your logrotate configration file (or in the specific /etc/logrotate.d sub-file), you must have a section like:

/var/log/samba/log.smbd {
        ...
        postrotate
                /etc/init.d/smbd reload > /dev/null
        endscript
        ...
}

Change the postrotate command to:

/var/log/samba/log.smbd {
        ...
        postrotate
                { pidof smbd && /etc/init.d/smbd reload; } > /dev/null
        endscript
        ...
}

You must log in to answer this question.

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