Add option for uploading debug log to termbin

This commit is contained in:
Adam Warner 2016-08-01 21:43:13 +01:00 committed by Promofaux
parent fb69bf551e
commit 95edb49bb8

View file

@ -338,7 +338,16 @@ function dumpPiHoleLog {
# Anything to be done after capturing of pihole.log terminates
function finalWork {
echo "::: Finshed debugging!"
echo "::: The degug log can be uploaded to Termbin.com for easier sharing."
read -r -p "::: Would you like to upload the log? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
TERMBIN=$(cat /var/log/pihole_debug.log | nc termbin.com 9999)
;;
*)
echo "::: Log will NOT be uploaded to Termbin."
;;
esac
# Check if termbin.com is reachable. When it's not, point to local log instead
if [ -n "$TERMBIN" ]
@ -348,6 +357,7 @@ function finalWork {
echo "::: Debug log can be found at : /var/log/pihole_debug.log"
fi
}
trap finalWork EXIT
### Method calls for additional logging ###