#!/bin/bash
# /usr/local/bin/syncbin
# https://crystalfaeries.net/posix/bin/syncbin
# celeste:crystalfaery SYNCBIN 2017-05-04 22:45:19+00:00
# RSYNC bin between bluehost server & local Linux(TM))
# THIS SCRIPT PRESUMES OUR /usr/local/bin CONTENTS ARE *ALL* GOOD FOR OTHERS
# WHEN IN FACT WE MAY HAVE CONTENT TOXIC TO OTHER LINUX/POSIX/UNIX SYSTEMS.
# LIKEWISE WE TRUST THE REMOTE SYSTEM'S CONTENT TO BE GOOD FOR US.
# This is INSANITY UNLESS WE physically possess and control and administer,
# unless we MONITOR the LOG OF EACH SYNC to DETECT UPDATES TO OUR SYSTEM!
# "man rsync" will deliver the explanation of the options we default to.
# My personal "take" was that I would "almost never" need an alternative.
# Bluehost proves the exception with an rsync of incompatible compression,
# which turns -auvzH into -auvH as option set.
# force executable PERMISSIONS for scripts
/usr/local/bin/executable # script to normalize dir/file permissions
# BACKUP local scripts library TO SERVER
rsync -auvH /usr/local/bin divservi@box6537.bluehost.com:~ \
|& tee -a /var/log/chronicle.log
# (notice we align vertically the same directory specs.)
# BACKUP server scripts library TO LOCAL (BEWARE: TRUSTING REMOTE SERVER)
# we would prefer /usr/local/bin to appear last in our "${PATH}"
rsync -auvH divservi@box6537.bluehost.com:~/bin \
/usr/local |& tee -a /var/log/chronicle.log
# force executable PERMISSIONS for scripts
/usr/local/bin/executable # script to normalize dir/file permissions
exit $? # return results of executable permissions setting ops
# old version for LAN use
#!/bin/bash
# http://crystalfaeries.net/posix/bin/syncbin
# celeste:crystalfaery 2013-01-19 17:42:52+00:00
let result=0 # success
echo "`now` ======= $0 ======= $0 =======" || let result=1 # counting forwards from beginning of file
echo 'rsync -auvzH --exclude=htsearch /usr/lib/cgi-bin/* /usr/local/bin'
rsync -auvzH --exclude=htsearch /usr/lib/cgi-bin/* /usr/local/bin # cgi bins are executable scripts cloned to local scripts directory published via www
echo 'rsync -auvzH /usr/local/bin/* `/usr/local/bin/my_twin`:/usr/local/bin'
rsync -auvzH /usr/local/bin/* `/usr/local/bin/my_twin`:/usr/local/bin # send our updates
echo 'rsync -auvzH `/usr/local/bin/my_twin`:/usr/local/bin/* /usr/local/bin'
rsync -auvzH `/usr/local/bin/my_twin`:/usr/local/bin/* /usr/local/bin # gather theirs (less whatever we just overwrote :-)
echo "`now` ------- $0 ------- $0 -------" || let result=255 # counting backwards from end of file
exit $result
syntax highlighted by Code2HTML, v. 0.9.1