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

Supress command output #22

Closed
singpolyma opened this issue Jul 14, 2021 · 4 comments
Closed

Supress command output #22

singpolyma opened this issue Jul 14, 2021 · 4 comments

Comments

@singpolyma
Copy link

In my cron I'd like output to go to healthchecks and not to my email. I'm adding >/dev/null after the runitor command now, but it would be nice if runitor just didn't pass through the output it had captured.

@bdd
Copy link
Owner

bdd commented Jul 14, 2021

Are you asking for an addition of a separate command line parameter for suppressing output to the terminal?

I prefer not to introduce additional flags for functionality that can be achieved by often well understood shell constructs.

@singpolyma
Copy link
Author

Well, I'm a bit worried that suppressing the whole output means I'm also suppressing any errors from runitor itself, right? If runitor fails, I'd like to know things have gotten that bad, but I don't see why I would ever want the output of my inner command to leak out of runitor.

@bdd
Copy link
Owner

bdd commented Jul 14, 2021

[...] suppressing the whole output means I'm also suppressing any errors from runitor itself, right?

If runitor fails to execute passed command, (e.g. file not found, no permission to execute, ran out of PIDs , etc.) it will first fail the health check and add the error to the body of the health check ping. Moreover the same error will be output to stderr (https://github.com/bdd/runitor/blob/main/cmd/runitor/main.go#L188) so you'll also get an email from your cron daemon, which was only forwarding stdout to /dev/null.

Since 0.7.0 runitor combines the stdout and stderr of the command it runs into its own stdout. The reasons for this is explained in the 0.7.0 release notes under "Changes". So in case runitor successfully executes the passed command but that command returns a non-zero exit value, you'll only be able to see the stdout and stderr of the command in the healthchecks.io ping body. But this will not go unnoticed, because non-zero exit value from the command will fail the health check. In case of your passed command outputting things to stderr but still exiting with zero exit code, will indeed go unnoticed by your cron. To best of my knowledge this last case cannot be addressed by a simple addition to runitor, as explained in 0.7.0 release notes.

@singpolyma
Copy link
Author

Ok, inner command stderr goes to runitor stdout and runitor errors go to stderr. I think that works fine for me then. Thanks for explaining.

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

No branches or pull requests

2 participants