mirror of
https://github.com/gbdev/awesome-gbdev.git
synced 2025-08-19 06:12:15 +02:00
Add script to check HTTP status for URLs.
This commit is contained in:
23
scripts/urls-http-status
Executable file
23
scripts/urls-http-status
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Find URLs in ../README.md and print them with their HTTP status code.
|
||||||
|
#
|
||||||
|
# Example usage:
|
||||||
|
#
|
||||||
|
# $ ./scripts/urls-http-status | sort
|
||||||
|
# 200 http://example.com/page.html
|
||||||
|
# 200 http://example.com/another-page.html
|
||||||
|
# [...]
|
||||||
|
# 404 http://example.com/missing-page.html
|
||||||
|
#
|
||||||
|
# Changing the number of parallel processes is possible. The default is 10.
|
||||||
|
#
|
||||||
|
# $ MAX_PARALLEL=100 ./scripts/urls-http-status
|
||||||
|
|
||||||
|
MAX_PARALLEL=${MAX_PARALLEL:-10}
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
grep -Eoie "\(https?://.*?\)" "$DIR/../README.md" |\
|
||||||
|
cut -d "(" -f 2 |\
|
||||||
|
cut -d ")" -f 1 |\
|
||||||
|
xargs -n1 -P "$MAX_PARALLEL" curl -o /dev/null --silent --head --write-out "%{http_code} %{url_effective}\n"
|
Reference in New Issue
Block a user