Created
June 20, 2010 19:52
-
-
Save wheresalice/446055 to your computer and use it in GitHub Desktop.
script for vbackup to support cfbackup so we can copy backup files to rackspace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This file is part of vbackup. | |
# | |
# vbackup is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. | |
# | |
# vbackup is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with vbackup; if not, write to the Free Software | |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | |
# | |
# $Id$ | |
# | |
# Description | |
# | |
# Backup to Rackspace with cfbackup | |
# | |
NAME="cfbackup" | |
VERSION="0.0.1" | |
DESC="Backup to Rackspace with cfbackup" | |
LICENSE="GPLv2" | |
COPYRIGHT="Copyright (c) 2010 Alice Kaerast" | |
CONTACT="kaerast@computergentle.com" | |
# Display help | |
do_help() | |
{ | |
cat << _END | |
This method copies a file or a tree to a rackspace using cfbackup. It can be | |
used at the end of a backup to copy the backup to a rackspace. | |
For this to work you need to have cfbackup installed and configured. | |
Configuration options: | |
SOURCE The local directory to copy data from (required) | |
CONTAINER Where are we backing up to (required) | |
_END | |
} | |
# Check configuration | |
# return: 0: ok, 1: error | |
do_check_conf() | |
{ | |
# [ -z "$SOURCE" ] && h_error "Missing SOURCE" && return 1 | |
[ -z "$CONTAINER" ] && h_error "Missing CONTAINER" && return 1 | |
return 0 | |
} | |
# Do backup | |
do_run() | |
{ | |
if [ "x$ABORT" = "x1" ] ; then | |
return 0 | |
fi | |
# Form source | |
h_transform "$SOURCE" | |
T="${R:0:0}" | |
if ! [ "x$T" = "x/" ] ; then | |
SRC="$DESTDIR0/$R" | |
else | |
SRC="$R" | |
fi | |
h_msg 6 "$SRC -> $CONTAINER" | |
if /var/lib/gems/1.8/bin/cfbackup --action push --local_path $SRC --container $CONTAINER; then | |
h_msg 6 "cfbackup succeeded" | |
else | |
h_msg 2 "cfbackup failed" | |
fi | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment