corz.org uses cookies to remember that you've seen this notice explaining that corz.org uses cookies, okay!
corz.org text viewer..
[currently viewing: / public/ linux/ usr/ local/ bin/ corz-backup.sh - raw]
if [ -z $1 ]; then
echo
echo "Please supply a domain name on the command-line. e.g.."
echo
echo "$0 foobar.net"
echo
echo "corz-backup will then use settings file: ~/.sftp/foobar.net"
echo
exit 1
fi
. ~/.sftp/$1
newname="$now.$host.tar.gz"
echo "backup for $host: "`date "+%Y.%m.%d-%H.%M"`.. >> $logfile
echo >> $logfile
echo "backup for $host (full version - with archiving)"
cd $backupdir
for i in $( find $host -name \"*.mp3\" ); do rm "$i"; done
echo "archiving current dev mirror.."
tar cfz $newname $host >> $logfile
if [ ! -d $arcroot ]; then
mkdir -pv $arcroot > /dev/null
fi
mv $newname $arcroot/ >> $logfile
remount > /dev/null
if [ ! -d $ol_daily ]; then
mkdir -pv $ol_daily > /dev/null
fi
if [ -e "$ol_daily" ];then
echo -n "Copying site backup to offline storage facility.. "
cp $arcroot/$newname $ol_daily/
if [ -e "$ol_daily/$newname" ];then
echo "Success!"
rm $arcroot/$newname >> $logfile &> /dev/null
rmdir $arcroot &> /dev/null
fi
fi
echo "copying (& logging) changed files to dev mirror backup.."
cp -d -f -p -r -u -v $homebsp;$backupdir/$host >> $logfile
now=`date "+%Y.%m.%d-%H.%M"`
echo >> $logfile
command -v fortune >/dev/null 2>&1 || { echo "backup for $host complete!"; exit 0; }
fortune
echo "backup complete at $now"
exit 0