cronie-crond / cronie

Cronie cron daemon project
Other
467 stars 80 forks source link

Add support for simple log outputs as alternative to email #147

Closed JohnnyJayJay closed 1 year ago

JohnnyJayJay commented 1 year ago

This PR adds support for a new environment variable INHERIT_OUTPUTS which, when set, indicates that the outputs (stdout and stderr) of a job should not be sent by mail and instead just be written to stdout/stderr as usual. The value of this feature is that it allows for a more uniform logging approach without a mail server set up.

For example, on my system, anacron is run by cronie every hour (as is the default). The outputs of cronie and anacron are logged in journalctl. It would be nice to have the logs of my anacron jobs there as well, which can be achieved by leaving stdout and stderr of the job processes as-is.

This PR's motivation is similar to that of #135 but completely ignores the mail functionality.

t8m commented 1 year ago

Looks good except one thing. I'd call the variable simply NO_MAIL_OUTPUT.

JohnnyJayJay commented 1 year ago

Looks good except one thing. I'd call the variable simply NO_MAIL_OUTPUT.

Done.

JohnnyJayJay commented 1 year ago

Just to be clear, since some of the annotations refer to code that was not written by me: do you want me to reformat the whole anacron project for consistency? I find the style questionable, but intentionally decided against touching it and left it as-is. This concerns indentation, curly braces and new lines.

t8m commented 1 year ago

Just to be clear, since some of the annotations refer to code that was not written by me: do you want me to reformat the whole anacron project for consistency? I find the style questionable, but intentionally decided against touching it and left it as-is. This concerns indentation, curly braces and new lines.

No, do not reformat please. Just change the lines I've commented about.

t8m commented 1 year ago

Merged. Thank you for your contribution.