corz.org text viewer..
[currently viewing: /public/linux/usr/local/bin/bup.sh - raw]
#!/bin/bash

#    corzblog update script
#
#    takes a snap-shot backup of my current /blog/ code
#    then uploads the latest code to corz.org/blog/..
#
#    this runs when I have made everything sweet, and want it live.
#    it can get used a lot in one session, manually from the shell.
#
#    [note: content & code is backed-up separately, every night]
#
#    this script has been refined over time, 
#    so you may find it a useful automatic ftp example.
#
#    For a more comprehensive (and secure) website sync, see here..
#    http://corz.org/public/machine/source/php/website-sync-linux.php
#    
#    ;o)
#    (or
#
#     2003-> (or @ corz.org ;o)
#

# prefs..

HOST="domain.org"
USER="UserName"
PASSWD="MyPassW0rd"

# the location of your development mirror, as seen by the file system..
LOCAL="/home/MyFolder"

# the location of your live web root, as seen by the ftp server..
REMOTE="/public_html"

# where to dump the backups..
BAX="/bax/www"

# end prefs.


# the backup file name will be date-coded..
NOW=`date "+%Y.%m.%d-%H.%M"`

echo
echo "corzblog update script.."

# backup..
echo
echo "archiving old blog folders.."

mkdir $BAX/cb
cp -R $LOCAL/blog/**/bsp;$BAX/cb

# remove unwanted files from the code backup, save bloat.
rm -rf $BAX/cb/arc $BAX/cb/img $BAX/cb/audio $BAX/cb/inc/spelling/**/ist $BAX/cb/inc/**/ip

# zip the backup and move to the backup folder.
cd $BAX/
tar cfz corzblog-bax-$NOW.tar.gz cb > /dev/null
mv corzblog-bax* $BAX/_arc/blog/
rm -rf $BAX/cb

echo
echo "performing ftp operations.."

# -i so we don't get bugged with questions
ftp -i -n $HOST <<FTP_QUIT
quote USER $USER
quote PASS $PASSWD
ascii

lcd "$LOCAL/blog"
cd "$REMOTE/blog"
mput "*.php"

lcd "$LOCAL/blog/inc"
cd "$REMOTE/blog/inc"
mput "*.php"

lcd "$LOCAL/blog/inc/js"
cd "$REMOTE/blog/inc/js"
mput "*.js"

FTP_QUIT

echo
echo "all done"
echo

exit 0

Welcome to corz.org!

Since switching hosts (I hope you are alright, Ed! Wherever you are …) quite a few things seems to be wonky.

Juggling two energetic boys (of very different ages) on Coronavirus lockdown, I'm unlikely to have them all fixed any time soon. Mail me! to prioritise!