#!/bin/bash
#                       /usr/local/bin/sync_fay-bluehost	
# https://crystalfaeries.net/posix/bin/sync_fay-bluehost	
# celeste:crystalfaery SYNC_FAY-BLUEHOST 2018-06-07 06:00:29+00:00
# hand-taylored rsync backup/mirroring script to map filesystem layouts between:
# "fay" (if i could set her hostname in TermUX), my Android.
# BlueHost server box6537.bluehost.com.

# CONFIGURATION:
let SSHleep=10	# BLUEHOST RATE-LIMITS SSH CONNECTIONS :-(
# see also:	TOP LEVEL DIRECTORIES INCLUDED
# see also:	EXCLUDES (for disk-space limits on fay)

echo "=======	crystalfaeries.net	======="	1>&2
# collect updates to loose files at top level of site crystalfaeries.net
rsync -auvH --dry-run			~/crystalfaeries.net/{{.,}*.txt,*.html}	\
	  divservi@box6537.bluehost.com:~/crystalfaeries.net/
echo -n "SSHleeping	${SSHleep}: "	1>&2
		uptime			1>&2
		sleep	${SSHleep}	# BLUEHOST RATE-LIMITS SSH CONNECTIONS :-(

#	TOP LEVEL DIRECTORIES:	(SOME ARE MISSING!)
for target in	\
	celeste	\
	linkdoc	\
	posix	\
	src	\
	fae	\
	pdf	\
	audio	\
	video
do	# roughly size order for directories
	echo "========	${target}	========"	1>&2
#	EXCLUDES (for disk-space limits on fay)
	rsync	-auvH		\
--dry-run			\
--exclude=faeries		\
--exclude=mystic_journey	\
--exclude=zz_top		\
--exclude=posix/bin		\
					~/crystalfaeries.net/"${target}"/{.??,}* \
	  divservi@box6537.bluehost.com:~/crystalfaeries.net/"${target}"/
echo "-------	${target}	-------"	1>&2
echo -n "SSHleeping	${SSHleep}: "	1>&2
	uptime				1>&2
	sleep		${SSHleep}	# BLUEHOST RATE-LIMITS SSH CONNECTIONS :-(
done

# Backup scripts
echo "========	POSIX/bin	========"	1>&2
rsync -auvH --dry-run			    ~/crystalfaeries.net/posix/bin/{.??,}* \
divservi@box6537.bluehost.com:/home1/divservi/crystalfaeries.net/posix/bin/
echo "-------	POSIX/bin	-------"	1>&2
echo -n "SSHleeping	${SSHleep}: "	1>&2
	uptime				1>&2
	sleep		${SSHleep}	# BLUEHOST RATE-LIMITS SSH CONNECTIONS :-(

# Grab the imgs sans the igal2 thumbnails for web access
echo "========	imgs	========"	1>&2
rsync	-auvH	\
--dry-run		\
--exclude='*/*/*.css'	\
--exclude='*/*/?.html'	\
--exclude='*/*/??.html'	\
--exclude='*/*/???.html'	\
--exclude='*/*/????.html'	\
--exclude='*/*/.indextemplate2.html'	\
--exclude='*/*/.slidetemplate2.html'	\
--exclude='*/*/.thumb_*'	\
--exclude='*/*/.tile.png'	\
--exclude='*/*.css'	\
--exclude='*/?.html'	\
--exclude='*/??.html'	\
--exclude='*/???.html'	\
--exclude='*/????.html'	\
--exclude='*/.indextemplate2.html'	\
--exclude='*/.slidetemplate2.html'	\
--exclude='*/.thumb_*'	\
--exclude='*/.tile.png'	\
--exclude='*.css'	\
--exclude='?.html'	\
--exclude='??.html'	\
--exclude='???.html'	\
--exclude='????.html'	\
--exclude='.indextemplate2.html'	\
--exclude='.slidetemplate2.html'	\
--exclude='.thumb_*'	\
--exclude='.tile.png'	\
				~/crystalfaeries.net/imgs/{.??,}*	\
  divservi@box6537.bluehost.com:~/crystalfaeries.net/imgs/
echo "-------	imgs	-------"	1>&2
echo -n "SSHleeping	${SSHleep}: "	1>&2
	uptime				1>&2
	sleep		${SSHleep}	# BLUEHOST RATE-LIMITS SSH CONNECTIONS :-(

# Grab the clipart sans the igal2 thumbnails for web access
echo "========	clipart	========"	1>&2
rsync	-auvH	\
--dry-run		\
--exclude='*.css'	\
--exclude='?.html'	\
--exclude='??.html'	\
--exclude='???.html'	\
--exclude='????.html'	\
--exclude='.indextemplate2.html'	\
--exclude='.slidetemplate2.html'	\
--exclude='.thumb_*'	\
--exclude='.tile.png'	\
				~/crystalfaeries.net/imgs/clipart/{.??,}*	\
  divservi@box6537.bluehost.com:~/crystalfaeries.net/clipart/
echo "-------	clipart	-------"	1>&2
echo -n "SSHleeping	${SSHleep}: "	1>&2
	uptime				1>&2
	sleep		${SSHleep}	# BLUEHOST RATE-LIMITS SSH CONNECTIONS :-(

echo "-------	crystalfaeries.net	-------"	1>&2
exit	$?

