aboutsummaryrefslogtreecommitdiff
path: root/misc/rsnapshot/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'misc/rsnapshot/contrib')
-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
7 files changed, 159 insertions, 0 deletions
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"