#!/bin/bash # Removed because wget errors with error 8 (Server issued an error response.) #set -e ## This script will scan www.taler.net for broken links and e-mail a copy of the log if any are found. logfile="linkchecker.log" # Remove old log if [ -f "$logfile" ] then echo $logfile " exists. Moving to" $logfile".old." mv $logfile $logfile.old else echo "Info: existing log file '$logfile' not found." fi # Use wget to scan www.taler.net and save output echo echo "Running this command:" echo " wget --spider -r -nd -nv -H -l 1 -w 2 -o $logfile https://www.taler.net/" wget --spider -r -nd -nv -H -l 1 -w 2 -o $logfile https://www.taler.net/ # display logfile echo echo "Displaying contents of logfile" cat $logfile # Search the log for the phrase "broken link" as this is what wget will report if grep -iRl 'broken link!!' $logfile then echo "Found broken links. Build should fail (exit 1), triggering e-mail notification." exit 1 else echo "No broken links found. Nothing more to do." exit 0 fi