#!/bin/bash
#                 /usr/local/bin/ftpwatch
# http://kahealani.net/posix/bin/ftpwatch
# celeste:crystalfaery 2015-01-08 17:37:52+00:00
# we expect to be invoked periodically by cron to notify of FTP incoming files
/bin/mkdir -p /tmp/ftp					> /dev/null 2>&1 || exit -1
cd	 /tmp/ftp					> /dev/null 2>&1 || exit -2
/bin/mv index.html index.html-				> /dev/null 2>&1
/usr/bin/X11/wget ftp://anonymous@127.0.0.1/incoming/	> /dev/null 2>&1
/usr/bin/X11/diff index.html- index.html		> /dev/null 2>&1
if [[ $? ]]
then
	echo true					> /dev/null 2>&1
else
	/usr/bin/X11/mail -s FTP_incoming `/usr/bin/X11/whoami` < index.html
fi


syntax highlighted by Code2HTML, v. 0.9.1