-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #338 from nicksinger/dehydrated_filter
Add dehydrated cron output filter script
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
usage() { | ||
cat << EOF | ||
Usage: dehydrated --cron | $0 [OPTIONS] | ||
Filter dehydrated cron output to only contain error messages as upstream suggested in | ||
https://github.com/dehydrated-io/dehydrated/issues/47#issuecomment-221867853 | ||
Options: | ||
-h, --help display this help | ||
EOF | ||
exit "$1" | ||
} | ||
main() { | ||
opts=$(getopt -o h -l help -n "$0" -- "$@") || usage 1 | ||
eval set -- "$opts" | ||
while true; do | ||
case "$1" in | ||
-h | --help) usage 0 ;; | ||
--) | ||
shift | ||
break | ||
;; | ||
*) break ;; | ||
esac | ||
done | ||
grep -v "^# INFO" | perl -0pe "s/Processing (.*)*\n \+ (.*)unchanged.\n \+ Checking .*\.\.\.\n \+ Valid till (.*) \(Longer than .* Skipping renew!//gm" | grep -v "^$" | ||
} | ||
caller 0 > /dev/null || main "$@" |