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

Silence updateGravity cron job unless errors occur #2470

Merged
merged 2 commits into from
Oct 21, 2018
Merged

Silence updateGravity cron job unless errors occur #2470

merged 2 commits into from
Oct 21, 2018

Conversation

jeremysherriff
Copy link
Contributor

By submitting this pull request, I confirm the following:

  • I have read and understood the contributors guide, as well as this entire template.
  • I have made only one major change in my proposed changes.
  • I have commented my proposed changes within the code.
  • I have tested my proposed changes, and have included unit tests where possible.
  • I am willing to help maintain this change if there are issues with it later.
  • I give this submission freely and claim no ownership.
  • It is compatible with the EUPL 1.2 license
  • I have squashed any insignificant commits. (git rebase)

Please make sure you Sign Off all commits. Pi-hole enforces the DCO.


What does this PR aim to accomplish?:
Quieten the updateGravity cron job for successful runs.
Fixes #2424

How does this PR accomplish the above?:
Update the Pi-hole cron file to pipe all stdout to a log file.
Display all logged output to stdout if exit code not zero, via || command linking.
Requires minor tweak of pihole master script to return exit code from gravity.sh to cron parent process.

What documentation changes (if any) are needed to support this PR?:
None. Cron file contains comments to explain the more complex command structure.


  • You must follow the template instructions. Failure to do so will result in your pull request being closed.
  • Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time.

No need for append/logrotate as we are only interested in the latest output
Signed-off-by: jeremysherriff <jeremysherriff@gmail.com>
Signed-off-by: jeremysherriff <jeremysherriff@gmail.com>
@jeremysherriff
Copy link
Contributor Author

jeremysherriff commented Oct 19, 2018

This would have been better handled by adding a quiet flag for the gravity.sh script in the same way that the flush script has, squashing any non-error output. However the way that gravity's blocklist fetch status output is written makes that very difficult (the use of echo -ne to replace pending with success/failure) and it is beyond my capabilities to retrofit such complex message handling 😄
Maybe one day someone could rewrite gravity to factor in a genuine quiet flag.

@AzureMarker AzureMarker added the Bug: fixed Contains a bug resolution label Oct 21, 2018
@AzureMarker AzureMarker merged commit 49b8ad7 into pi-hole:development Oct 21, 2018
@jeremysherriff jeremysherriff deleted the patch-1 branch October 30, 2018 07:35
@mitchellrj
Copy link

Thank you very much for this - it's been bothering me for a while so I finally got around to looking into fixing it and found you already had! :)

@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/make-output-of-cron-jobs-suppressible-have-no-output/1551/5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: fixed Contains a bug resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants