Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stay silent about firstaction error #579

Open
uli42 opened this issue Jan 22, 2024 · 0 comments
Open

stay silent about firstaction error #579

uli42 opened this issue Jan 22, 2024 · 0 comments

Comments

@uli42
Copy link

uli42 commented Jan 22, 2024

We have a process that can run for 1-2 days and want to rotate its logfiles usign logrotate. However, the logfiles MUST NOT be rotated while that process is running and it cannot be signalled or stopped intermediately. So a colleague implemented a config file similar to this:

/var/log/logfile
{
  sharedscripts
  firstaction
    # abort logrotate if some-process is running
    ! /bin/pgrep some-process >/dev/null
  endscript
  copytruncate
  missingok
  notifempty
  rotate 30
  compress
}

So the idea is to check for the process in question and return an error if it is running to make logrotate skip this partiular rotation.

This works, but everytime the process is found running firstaction will return an error and logroate will inform us via mail (from cron) like this:

/etc/cron.daily/logrotate:

error: error running first action script for /var/log/logfile

As there's no need to send a mail in that case we are wondering if there's a way to silently (= no mail) skip rotation? If not consider this a feature request ;-)

Update: fixed missing quote

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant