When using logrotate with wildcards, you can specify that a postrotate
script should only run once so that if e.g. you were rotating a bunch
of log files from one apache server, you would only restart apache once.
However, I have a slightly different requirement - I'd like to run the
postrotate script once for each log file (in this case I'm rotating
production.log files for Rails apps running under passenger) hence I'd
use nosharedscripts (which is anyway the default) but I need to pass
the script a parameter which is the name of the log file which was
just rotated (so that passenger can restart the appropriate Rails
instance). Ideally, I'd like to be able to have a logrotate.d/rails
config like this
where passenger_restart is a script which will restart passenger for a
given app, given its production log file name, and $LOG is the
particular log file which has now been matched by the wildcard. Sadly,
logrotate doesn't seem to have the ability to produce $LOG.
The only idea I have is to generate the logrotate.d/rails config file
on the fly each time which would work, and wouldn't be particularly
difficult, but it's a bit of a kludge - I'd prefer a solution whch
works entirely within logrotate.
I have RTFM and STFW but with no success, so as a last resort I turn
to the collective wisdom of ILUG - any ideas?
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!