January 31, 2017, 7:33am
Every time one of the cron-jobs that comes with pi-hole is carried out, an email is sent to root (even when successful). This is because the cron-jobs have an output - even when succesfull. It is - of course - suppressible 'by hand' by adding
at the end of the jobs in
/etc/cron.d/pihole. However, this file is overwritten every time the software is updated.
It would be nice (imho) if there was an option to suppress output of the cron-jobs (when successful) in the web-interface OR that default for the successful carrying out of such a job would be "null".
You're better of using
>/dev/null, NOT >/dev/null 2>&1 This will suppress mails, if the cron job runs normally, but will still send a mail if the job fails, at least, that is what I did.
January 31, 2017, 12:00pm
You are absolutely right my friend.
This has been implemented
06:15AM - 19 Oct 18 UTC
**By submitting this pull request, I confirm the following:**
- [X] I have r
… ead and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template.
- [X] I have made only one major change in my proposed changes.
- [X] I have commented my proposed changes within the code.
- [X] I have tested my proposed changes, and have included unit tests where possible.
- [X] I am willing to help maintain this change if there are issues with it later.
- [X] I give this submission freely and claim no ownership.
- [X] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1)
- [X] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
Please make sure you [Sign Off](https://github.com/pi-hole/pi-hole/wiki/How-to-signoff-your-commits.) all commits. Pi-hole enforces the [DCO](https://github.com/pi-hole/pi-hole/wiki/Contributing-to-the-project).
**What does this PR aim to accomplish?:**
Quieten the updateGravity cron job for successful runs.
**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.