Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Apr 27, 2023

Conversation

JohnnyJayJay
Copy link
Contributor

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
Copy link
Member

t8m commented Apr 26, 2023

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

@JohnnyJayJay
Copy link
Contributor Author

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

Done.

Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final nits

man/anacrontab.5 Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
@JohnnyJayJay
Copy link
Contributor Author

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
Copy link
Member

t8m commented Apr 26, 2023

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.

@JohnnyJayJay JohnnyJayJay requested a review from t8m April 27, 2023 09:38
@t8m t8m merged commit 48d3569 into cronie-crond:master Apr 27, 2023
@t8m
Copy link
Member

t8m commented Apr 27, 2023

Merged. Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants