#!/bin/bash
#                       /usr/local/bin/link_lint
# https://crystalfaeries.net/posix/bin/link_lint
# celeste:crystalfaery LINK_LINT 2017-11-17 19:15:51+00:00
# weekly cronjob hyperlink verification of crystalfaeries.net

# Verify the links inside website:
linklint -host "http://crystalfaeries.net" -index index.html -orphan -root /home/crystalfaeries.net/ /@	\
								>& /home/crystalfaeries.net/linkdoc/linklint.local.txt
let return_value=$?
	if [ ${return_value} -ne 0 ]
	then
		echo "LOCAL ERROR: ${return_value}"		>> /home/crystalfaeries.net/linkdoc/linklint.local.txt
		exit	${return_value}
	fi

# Verify the links out of website to the external world:
linklint -concise_url -doc /home/crystalfaeries.net/linkdoc -redirect		\
	$(cut -f2- /home/crystalfaeries.net/links.txt | sed 's/https:/http:/')	\
								>& /home/crystalfaeries.net/linkdoc/linklint.external.txt
let return_value=$?
	if [ ${return_value} -ne 0 ]
	then
		echo "EXTERNAL ERROR: ${return_value}"		>> /home/crystalfaeries.net/linkdoc/linklint.external.txt
		exit	${return_value}
	fi

# Verify the links of our bookmarks file (while we're at it :-)
linklint -concise_url -doc ${HOME}/documents/bookmarks -redirect					\
	$(cut -f2- /home/crystalfaeries.net/src/.bookmarksbydate.fey.txt | grep -v 'place:' | sed 's/https:/http:/')	\
								>& /home/celeste/documents/bookmarks/linklint.bookmarks.txt
let return_value=$?
echo "BOOKMARKS ERROR: ${return_value}"				>> /home/celeste/documents/bookmarks/linklint.bookmarks.txt
exit	${return_value}



syntax highlighted by Code2HTML, v. 0.9.1