summaryrefslogtreecommitdiff
path: root/buildbot/linkchecker.sh
blob: 2b24f7c3afce5509e61d5bb7d877b6eca072996a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/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