aboutsummaryrefslogtreecommitdiff
path: root/misc/rsnapshot
diff options
context:
space:
mode:
Diffstat (limited to 'misc/rsnapshot')
-rw-r--r--misc/rsnapshot/README25
-rw-r--r--misc/rsnapshot/contrib/crontab8
-rw-r--r--misc/rsnapshot/contrib/rsnapshot.conf27
-rw-r--r--misc/rsnapshot/contrib/rsnapshot_backup_mysql32
-rw-r--r--misc/rsnapshot/contrib/rsnapshot_daily23
-rw-r--r--misc/rsnapshot/contrib/rsnapshot_hourly23
-rw-r--r--misc/rsnapshot/contrib/rsnapshot_monthly23
-rw-r--r--misc/rsnapshot/contrib/rsnapshot_weekly23
-rw-r--r--misc/rsnapshot/doinst.sh16
-rw-r--r--misc/rsnapshot/rsnapshot.SlackBuild78
-rw-r--r--misc/rsnapshot/rsnapshot.info8
-rw-r--r--misc/rsnapshot/slack-desc19
12 files changed, 305 insertions, 0 deletions
diff --git a/misc/rsnapshot/README b/misc/rsnapshot/README
new file mode 100644
index 0000000000000..1659d65b54a09
--- /dev/null
+++ b/misc/rsnapshot/README
@@ -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.
diff --git a/misc/rsnapshot/contrib/crontab b/misc/rsnapshot/contrib/crontab
new file mode 100644
index 0000000000000..a3aaad0b3e8ef
--- /dev/null
+++ b/misc/rsnapshot/contrib/crontab
@@ -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
diff --git a/misc/rsnapshot/contrib/rsnapshot.conf b/misc/rsnapshot/contrib/rsnapshot.conf
new file mode 100644
index 0000000000000..06e1c16d8238e
--- /dev/null
+++ b/misc/rsnapshot/contrib/rsnapshot.conf
@@ -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/
diff --git a/misc/rsnapshot/contrib/rsnapshot_backup_mysql b/misc/rsnapshot/contrib/rsnapshot_backup_mysql
new file mode 100644
index 0000000000000..5d75265d2cdeb
--- /dev/null
+++ b/misc/rsnapshot/contrib/rsnapshot_backup_mysql
@@ -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
diff --git a/misc/rsnapshot/contrib/rsnapshot_daily b/misc/rsnapshot/contrib/rsnapshot_daily
new file mode 100644
index 0000000000000..32d1e8acec32d
--- /dev/null
+++ b/misc/rsnapshot/contrib/rsnapshot_daily
@@ -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"
diff --git a/misc/rsnapshot/contrib/rsnapshot_hourly b/misc/rsnapshot/contrib/rsnapshot_hourly
new file mode 100644
index 0000000000000..3fcbf68bca454
--- /dev/null
+++ b/misc/rsnapshot/contrib/rsnapshot_hourly
@@ -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"
diff --git a/misc/rsnapshot/contrib/rsnapshot_monthly b/misc/rsnapshot/contrib/rsnapshot_monthly
new file mode 100644
index 0000000000000..096d419b21e67
--- /dev/null
+++ b/misc/rsnapshot/contrib/rsnapshot_monthly
@@ -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"
diff --git a/misc/rsnapshot/contrib/rsnapshot_weekly b/misc/rsnapshot/contrib/rsnapshot_weekly
new file mode 100644
index 0000000000000..bcdb797e3ce6d
--- /dev/null
+++ b/misc/rsnapshot/contrib/rsnapshot_weekly
@@ -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"
diff --git a/misc/rsnapshot/doinst.sh b/misc/rsnapshot/doinst.sh
new file mode 100644
index 0000000000000..eb706ba01d104
--- /dev/null
+++ b/misc/rsnapshot/doinst.sh
@@ -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
+
diff --git a/misc/rsnapshot/rsnapshot.SlackBuild b/misc/rsnapshot/rsnapshot.SlackBuild
new file mode 100644
index 0000000000000..f80892083858f
--- /dev/null
+++ b/misc/rsnapshot/rsnapshot.SlackBuild
@@ -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
diff --git a/misc/rsnapshot/rsnapshot.info b/misc/rsnapshot/rsnapshot.info
new file mode 100644
index 0000000000000..82d82f1786a27
--- /dev/null
+++ b/misc/rsnapshot/rsnapshot.info
@@ -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"
diff --git a/misc/rsnapshot/slack-desc b/misc/rsnapshot/slack-desc
new file mode 100644
index 0000000000000..2710d34f165df
--- /dev/null
+++ b/misc/rsnapshot/slack-desc
@@ -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: