On Wed, May 10, 2023 at 12:11 PM Per Jessen
preremove /usr/local/bin/archive_logfile.sh endscript } -------------------
My script /usr/local/bin/archive_logfile.sh contains
#!/bin/sh test -n "$1" || exit 75
log="$1" plus the rest
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.
logrotate calls sh -c "script content" xxx log-file-name where script content is literal text between preremove'/endscript. So it ends up calling /usr/local/bin/archive_logfile.sh without parameters. You need preremove /usr/local/bin/archive_logfile.sh $1 endscript Hopefully the filename will not contain a literal double quote :)