e
This commit is contained in:
parent
3825b32ea3
commit
00000d9569
1 changed files with 5 additions and 14 deletions
19
health.sh
19
health.sh
|
|
@ -5,9 +5,6 @@ MAX_JOBS=10
|
|||
RETRY_COUNT=3
|
||||
README="./readme.md"
|
||||
STATUSLOG=$(mktemp)
|
||||
PASSED=0
|
||||
FAILED=0
|
||||
EMPTY=0
|
||||
|
||||
get_status() {
|
||||
local url="$1"
|
||||
|
|
@ -51,12 +48,7 @@ get_status() {
|
|||
|
||||
case "$status_code" in
|
||||
200)
|
||||
if ! curl -skL -A "$UA" --max-time 5 "$url" | head -c 1 | grep -q '.'; then
|
||||
echo "| $channel | Empty body (404) | \`$url\` |" >>"$STATUSLOG"
|
||||
echo "EMPTY" >>"$STATUSLOG"
|
||||
else
|
||||
echo "PASS" >>"$STATUSLOG"
|
||||
fi
|
||||
echo "PASS" >>"$STATUSLOG"
|
||||
;;
|
||||
|
||||
4* | 5*)
|
||||
|
|
@ -105,21 +97,20 @@ check_links() {
|
|||
}
|
||||
|
||||
write_readme() {
|
||||
local passed redirected empty failed
|
||||
local passed failed
|
||||
|
||||
passed=$(grep -c '^PASS$' "$STATUSLOG")
|
||||
empty=$(grep -c '^EMPTY$' "$STATUSLOG")
|
||||
failed=$(grep -c '^FAIL$' "$STATUSLOG")
|
||||
|
||||
{
|
||||
echo "## Log @ $(TZ="UTC" date "+%Y-%m-%d %H:%M %Z")"
|
||||
echo
|
||||
echo "### ✅ Working Streams: $passed<br>➖ Empty Streams: $empty<br>❌ Dead Streams: $failed"
|
||||
echo "### ✅ Working Streams: $passed<br>❌ Dead Streams: $failed"
|
||||
echo
|
||||
|
||||
if (($failed > 0 || $empty > 0)); then
|
||||
if (($failed > 0)); then
|
||||
head -n 1 "$STATUSLOG"
|
||||
grep -v -e '^PASS$' -e '^FAIL$' -e '^EMPTY$' -e '^---' "$STATUSLOG" | grep -v '^| Channel' | sort -u
|
||||
grep -v -e '^PASS$' -e '^FAIL$' -e '^---' "$STATUSLOG" | grep -v '^| Channel' | sort -u
|
||||
fi
|
||||
|
||||
echo "---"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue