misc/rsnapshot: Added to 12.0 repository

This commit is contained in:
Sean Donner 2010-05-11 20:01:09 +02:00 committed by Robby Workman
parent c25ac953ad
commit 988861d8dc
12 changed files with 305 additions and 0 deletions

25
misc/rsnapshot/README Normal file
View file

@ -0,0 +1,25 @@
rsnapshot is a filesystem snapshot utility for making backups of local
and remote systems. Using rsync and hard links, it is possible to keep
multiple, full backups instantly available. The disk space required is
just a little more than the space of one full backup, plus
incrementals.
rnapshot requires both the editing of the /etc/rsnapshot.conf file and
the creation of various scripts to run at the intervals specified in the
config file. rsnapshot comes with a multitude of example scripts located
in '/usr/doc/rsnapshot-1.3.0/utils' and has a well documented HOWTO at
'/usr/doc/rsnapshot-1.3.0/rsnapshot-HOWTO.en.html'
It is highly recommended for you to read this HOWTO prior to altering your
configuration.
To get you up and running as quick as possible, I have provided a working
config file and scripts located in '/usr/doc/rsnapshot-1.3.0/contrib'
This configuration will create incremental backups every 4 hours and will
store 6 hourly, 7 daily, 4 weekly, and 3 monthly backups at a time.
All backups will be stored in the path '/backup' which you will most
likely want to change to fit your setup. It is highly recommended that
the backup location be a separate physical disk or remote location.
rsnapshot is executed by adding entries into root's crontab.
There is an example crontab in '/usr/doc/rsnapshot-1.3.0/contrib/crontab'
with the necessary additions to run the scripts above.

View file

@ -0,0 +1,8 @@
# Add the following lines to your root's crontab.
# Make sure the paths to the rsnapshot_* scripts
# are pointing to the correct location
0 */4 * * * /etc/rsnapshot_hourly
50 2 * * * /etc/rsnapshot_daily
40 2 * * 1 /etc/rsnapshot_weekly
30 2 1 * * /etc/rsnapshot_monthly

View file

@ -0,0 +1,27 @@
config_version 1.2
snapshot_root /backup/
cmd_cp /usr/bin/cp
cmd_rm /usr/bin/rm
cmd_rsync /usr/bin/rsync
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du
cmd_rsnapshot_diff /usr/bin/rsnapshot-diff
interval hourly 6
interval daily 7
interval weekly 4
interval monthly 3
verbose 2
loglevel 3
logfile /var/log/rsnapshot
lockfile /var/run/rsnapshot.pid
exclude mnt/
exclude sys/
exclude proc/
backup / .
# Uncomment the following line to have rsnapshot backup your mysql
# databases. Make sure you read the 'rsnapshot_backup_mysql'
# script for instructions on how to have rsnapshot use the correct
# user and password to access your databases
#backup_script /etc/rsnapshot_backup_mysql mysql/

View file

@ -0,0 +1,32 @@
#!/bin/sh
##############################################################################
# backup_mysql.sh
#
# by Nathan Rosenquist <nathan@rsnapshot.org>
# http://www.rsnapshot.org/
#
# This is a simple shell script to backup a MySQL database with rsnapshot.
#
# The assumption is that this will be invoked from rsnapshot. Also, since it
# will run unattended, the user that runs rsnapshot (probably root) should have
# a .my.cnf file in their home directory that contains the password for the
# MySQL root user. For example:
#
# /root/.my.cnf (chmod 0600)
# [client]
# user = root
# password = thepassword
# host = localhost
#
# This script simply needs to dump a file into the current working directory.
# rsnapshot handles everything else.
##############################################################################
# $Id: backup_mysql.sh,v 1.5 2005/04/03 13:52:02 scubaninja Exp $
# backup the database
/usr/bin/mysqldump --all-databases > mysqldump_all_databases.sql
# make the backup readable only by root
/bin/chmod 600 mysqldump_all_databases.sql

View file

@ -0,0 +1,23 @@
#!/bin/bash
INTERVAL="daily"
RSNAPSHOT="/usr/bin/rsnapshot"
MOUNTPOINT="/backup"
LOGFILE="/var/log/rsnapshot"
PIDFILE="/var/run/rsnapshot.pid"
# Check to make sure rsnapshot isn't currently running
if [[ -f "$PIDFILE" ]]; then
echo "$PIDFILE already exists, skipping "$INTERVAL" run" >> "$LOGFILE"
exit
fi
# remount filesystem read/write
mount -o remount,rw "$MOUNTPOINT"
# call rsnapshot
"$RSNAPSHOT" "$INTERVAL"
# remount filesystem read-only
mount -o remount,ro "$MOUNTPOINT"

View file

@ -0,0 +1,23 @@
#!/bin/bash
INTERVAL="hourly"
RSNAPSHOT="/usr/bin/rsnapshot"
MOUNTPOINT="/backup"
LOGFILE="/var/log/rsnapshot"
PIDFILE="/var/run/rsnapshot.pid"
# Check to make sure rsnapshot isn't currently running
if [[ -f "$PIDFILE" ]]; then
echo "$PIDFILE already exists, skipping "$INTERVAL" run" >> "$LOGFILE"
exit
fi
# remount filesystem read/write
mount -o remount,rw "$MOUNTPOINT"
# call rsnapshot
"$RSNAPSHOT" "$INTERVAL"
# remount filesystem read-only
mount -o remount,ro "$MOUNTPOINT"

View file

@ -0,0 +1,23 @@
#!/bin/bash
INTERVAL="monthly"
RSNAPSHOT="/usr/bin/rsnapshot"
MOUNTPOINT="/backup"
LOGFILE="/var/log/rsnapshot"
PIDFILE="/var/run/rsnapshot.pid"
# Check to make sure rsnapshot isn't currently running
if [[ -f "$PIDFILE" ]]; then
echo "$PIDFILE already exists, skipping "$INTERVAL" run" >> "$LOGFILE"
exit
fi
# remount filesystem read/write
mount -o remount,rw "$MOUNTPOINT"
# call rsnapshot
"$RSNAPSHOT" "$INTERVAL"
# remount filesystem read-only
mount -o remount,ro "$MOUNTPOINT"

View file

@ -0,0 +1,23 @@
#!/bin/bash
INTERVAL="weekly"
RSNAPSHOT="/usr/bin/rsnapshot"
MOUNTPOINT="/backup"
LOGFILE="/var/log/rsnapshot"
PIDFILE="/var/run/rsnapshot.pid"
# Check to make sure rsnapshot isn't currently running
if [[ -f "$PIDFILE" ]]; then
echo "$PIDFILE already exists, skipping "$INTERVAL" run" >> "$LOGFILE"
exit
fi
# remount filesystem read/write
mount -o remount,rw "$MOUNTPOINT"
# call rsnapshot
"$RSNAPSHOT" "$INTERVAL"
# remount filesystem read-only
mount -o remount,ro "$MOUNTPOINT"

16
misc/rsnapshot/doinst.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/sh
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
config etc/rsnapshot.conf.new

View file

@ -0,0 +1,78 @@
#!/bin/sh
# Slackware build script for VDE2
# Copyright 2007-2008 Sean Donner (sean.donner@sbcglobal.net)
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=rsnapshot
VERSION=1.3.0
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
fi
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP || exit 1
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || exit 1
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var
make all || exit 1
make install DESTDIR=$PKG || exit 1
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} +
)
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYING ChangeLog README docs/HOWTOs/rsnapshot-HOWTO.en.html utils \
$CWD/contrib $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
mv $PKG/etc/rsnapshot.conf.default $PKG/etc/rsnapshot.conf.new
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz

View file

@ -0,0 +1,8 @@
PRGNAM="rsnapshot"
VERSION="1.3.0"
HOMEPAGE="http://www.rsnapshot.org"
DOWNLOAD="http://www.rsnapshot.org/downloads/rsnapshot-1.3.0.tar.gz"
MD5SUM="8487514517e78fe1cd1143ca67cb4b62"
MAINTAINER="Sean Donner"
EMAIL="sean.donner@sbcglobal.net"
APPROVED="rworkman"

19
misc/rsnapshot/slack-desc Normal file
View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
rsnapshot: rsnapshot (filesystem snapshot utility)
rsnapshot:
rsnapshot: rsnapshot is a filesystem snapshot utility for making backups of local
rsnapshot: and remote systems. Using rsync and hard links, it is possible to keep
rsnapshot: multiple, full backups instantly available. The disk space required is
rsnapshot: just a little more than the space of one full backup, plus
rsnapshot: incrementals.
rsnapshot:
rsnapshot:
rsnapshot:
rsnapshot: