Skip to content

Scripts don't get log paths passed to them. #7

@dkrand

Description

@dkrand

All of the script commands which are executed through the function runScript never get the path to the files that were rotated passed to it. The problem is that with "-c" /bin/sh only interprets the argument directly after the "-c", not the rest of the arguments. A test:

/bin/sh -c /bin/echo logrotate_script /var/log/messages

On every system I could find to test produces an empty line. It does not echo "logrotate_script /var/log/messages" to standard out.

The problem seems to be the execl in runScripts. Attached is a trivial test program that demonstrates the problem.

I'm not sure that simply fixing the problem is the right thing to do, because I'm betting that all of the existing scripts out there, most of which are used to re-load or re-start processes after the log files are rotated will break when they all of a sudden have a bunch of additional arguments on the command line.

It would seem that either the documentation needs to be updated to document exactly what logroate does, or add some feature to allow the arguments to be passed on certain scripts. Or an over-the-top suggestion would be to expand a string in the scripts to be the log paths?

test.c.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions