Dave Howorth wrote:
On Wed, 10 May 2023 11:11:36 +0200 Per Jessen
wrote: I just want to check I'm not going bonkers.
From the logrotate man page:
Which logrotate man page? Which version of logrotate on which system version? I ask because when I google, some versions of the man page don't even have a premove directive.
You're right, I should have mentioned it. It is version 3.18.1, on TW and Leap 15.4 and 15.5
So it sounds reasonable to expect "script" to be invoked with one argument, the name of the to-be-removed file. Right?
Kind of, but the repeated [elsewhere] mention of 'first' implies there might be more than one argument. But I can't find any trace of it. Just lots of discussion of quoting so filenames with spaces can be handled.
I can deal with multiple arguments, it is having none that is causing a problem :-)
Also, where is the SCRIPTS section? I can't find it.
Right after the preremove section.
---------------- /var/log/testfile { compress nodateext maxage 365 rotate 5 missingok notifempty size 1k sharedscripts postrotate /usr/bin/true endscript preremove /usr/local/bin/archive_logfile.sh endscript } -------------------
What's the point of the /usr/bin/true? I don't understand what that postrotate does.
That "true" is just a placeholder - normally it would be a reload of the syslog unit.
When I run a logrotate (either with systemd or manually), it does invoke the preremove script, but without the filename as argument, so my script leaves with a 75.
I'd be trying to print as much as possible from the execution of archive_logfile.sh (use -x?, print any and all args etc)
Yeah, done that too, but when there are no arguments ..... -- Per Jessen, Zürich (16.8°C) Member, openSUSE Heroes (2016 - present) We're hiring - https://en.opensuse.org/openSUSE:Heroes