taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

linkchecker.sh (1522B)


      1 #!/bin/bash
      2 # This file is in the public domain.
      3 #set -v
      4 # Removed because wget errors with error 8 (Server issued an error response.)
      5 #set -e
      6 
      7 ## This script will scan www.taler.net for broken links and e-mail a copy of the log if any are found.
      8 
      9 logfile="$HOME/linkchecker.log"
     10 wait_time="1"
     11 recurse_level="1"
     12 ignore_list="(.*)demo.taler.net(.*)\/orders\/(.*)" # appears to do *nothing*
     13 
     14 # Remove old log
     15 
     16 if [ -f "$logfile" ]
     17 	then
     18 		echo $logfile " exists.  Moving to" $logfile".old."
     19 		mv $logfile $logfile.old
     20 	else
     21 		echo "Info: existing log file '$logfile' not found."
     22 fi
     23 
     24 # Use wget to scan hosts and save output
     25 for url in "https://taler.net/" "https://docs.taler.net/" "https://taler-systems.com/" "https://demo.taler.net/" "https://bank.demo.taler.net/" "https://shop.demo.taler.net/" "https://stage.taler.net/" "https://taler-ops.ch/" "https://donations.demo.taler.net/" ;
     26 do
     27 	echo -e "\n\n#############################\n## Starting check on ${url}\n#############################\n"
     28 	linkchecker \
     29         -f $HOME/taler-deployment/worker-linkchecker/linkcheckerrc \
     30 		--no-robots \
     31         --no-status \
     32 		--check-extern \
     33 		--recursion-level="$recurse_level" \
     34 		"$url" | tee --append "$logfile"
     35 done
     36 
     37 # Search the log for the phrase "broken link" as this is what wget will report
     38 if grep -Rl 'Error' $logfile
     39 	then
     40 		echo "Found broken links.  Build should fail (exit 1), triggering e-mail notification."
     41         cat $logfile
     42 		exit 1
     43 	else
     44 		echo "No broken links found.  Nothing more to do."
     45 		exit 0
     46 fi