You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Props to https://www.commandlinefu.com/commands/view/8234/check-broken-links-using-wget-as-a-spider
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
if test "$#" -lt 1; then
|
|
|
|
echo >&2 "Usage: $0 <wget parameters, especially URL to test>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
logfile="$(pwd)/wget.log.$(date +%FT%T)"
|
|
|
|
tmp=$(mktemp --directory)
|
|
|
|
cd "$tmp"
|
|
|
|
|
|
|
|
wget --spider -o "$logfile" -r -p -X '/soustredeni/*/fotogalerie/' "$@" || true # wget nejspíš skončí s chybou, že něco nestáhl…
|
|
|
|
|
|
|
|
echo "Result: (a last few lines of the file $logfile)"
|
|
|
|
sed -ne '/^Found [0-9]* broken links/,$ p' "$logfile"
|