Skip to content
Snippets Groups Projects
Commit d52a1ac9 authored by micah's avatar micah :speech_balloon:
Browse files

Added trac handler, changed VSERVERS variable to be lowercase and

added some vserver documentation to README and to the handlers
parent 5c874587
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ Features: ...@@ -23,7 +23,7 @@ Features:
- backup actions can be scheduled - backup actions can be scheduled
- you can choose when status report emails are mailed to you - you can choose when status report emails are mailed to you
(always, on warning, on error, never). (always, on warning, on error, never).
- works with linux-vservers - works with Linux-Vservers (http://linux-vserver.org/)
The following options are available: The following options are available:
-h, --help This usage message -h, --help This usage message
...@@ -194,3 +194,21 @@ Installation: ...@@ -194,3 +194,21 @@ Installation:
# mkdir /etc/backup.d/ # mkdir /etc/backup.d/
# mv etc/backupninja.conf /etc/backupninja.conf # mv etc/backupninja.conf /etc/backupninja.conf
# mv handlers /usr/share/backupninja # mv handlers /usr/share/backupninja
VSERVERS
========
If you are using Linux-Vservers (http://linux-vserver.org/) there are some
special capabilities that different handlers have to make vserver backups easier.
Set the variable "vservers" to be "yes" in /etc/backupninja.conf and see the
example configuration files for each handler to configure the vserver specific
variables.
Additional vserver variables that can be configured in /etc/backupninja.conf. but
probably don't need to be changed:
VSERVERINFO (default: /usr/sbin/vserver-info)
VSERVER (default: /usr/sbin/vserver)
VROOTDIR (default: `$VSERVERINFO info SYSINFO |grep vserver-Rootdir | awk '{print $2}'; fi`)
...@@ -70,4 +70,6 @@ compress = yes ...@@ -70,4 +70,6 @@ compress = yes
# vsname = <vserver> (no default) # vsname = <vserver> (no default)
# what vserver to operate on, only used if vserver = yes in /etc/backupninja.conf # what vserver to operate on, only used if vserver = yes in /etc/backupninja.conf
# if you do not specify a vsname the host will be operated on # if you do not specify a vsname the host will be operated on
#
# NB: databases = all doesn't seem to work with hotcopy = yes when vsname is specified
# I would like to know how to fix this.
...@@ -41,6 +41,17 @@ include = /usr/local/sbin ...@@ -41,6 +41,17 @@ include = /usr/local/sbin
include = /var/lib/dpkg/status include = /var/lib/dpkg/status
include = /var/lib/dpkg/status-old include = /var/lib/dpkg/status-old
# If vservers = yes in /etc/backupninja.conf then the following variable can be used:
# vsinclude = <path>
# Any path specified in vsinclude is added to the include list for each vserver
# on the system.
# e.g. vsinclude = /home will backup the /home partition in every vserver
# on the system. If you have /vservers/foo, /vservers/bar and /vservers/baz
# this vsinclude will add to the include list /vservers/foo/home,
# /vservers/bar/home and /vservers/baz/home
# Included vservers are derived from listing all vservers in $VROOTDIR (suggestions
# for improving this are encouraged).
# files to exclude from the backup # files to exclude from the backup
# (supports globbing with '*') # (supports globbing with '*')
#exclude = /home/*/.gnupg #exclude = /home/*/.gnupg
......
...@@ -45,5 +45,5 @@ usecolors = yes ...@@ -45,5 +45,5 @@ usecolors = yes
when = everyday at 01:00 when = everyday at 01:00
# if running vservers, set to yes # if running vservers, set to yes
VSERVERS = no vservers = no
...@@ -28,7 +28,7 @@ fi ...@@ -28,7 +28,7 @@ fi
# If vservers are configured, decide if the handler should # If vservers are configured, decide if the handler should
# use them or if it should just operate on the host # use them or if it should just operate on the host
if [ "$VSERVERS" = "yes" ] if [ "$vservers" = "yes" ]
then then
if [ ! -z $vsname ] if [ ! -z $vsname ]
then then
......
...@@ -26,7 +26,7 @@ getconf user; destuser=$user ...@@ -26,7 +26,7 @@ getconf user; destuser=$user
getconf host; desthost=$host getconf host; desthost=$host
# See if vservers are configured # See if vservers are configured
if [ "$VSERVERS" = "yes" ] if [ "$vservers" = "yes" ]
then then
if [ ! -d $VROOTDIR ] if [ ! -d $VROOTDIR ]
then then
......
...@@ -12,7 +12,7 @@ error=0 ...@@ -12,7 +12,7 @@ error=0
# If vservers are configured, decide if the handler should # If vservers are configured, decide if the handler should
# use them or if it should just operate on the host # use them or if it should just operate on the host
if [ "$VSERVERS" = "yes" ] if [ "$vservers" = "yes" ]
then then
if [ ! -z $vsname ] if [ ! -z $vsname ]
then then
......
...@@ -27,7 +27,7 @@ getconf hardware yes ...@@ -27,7 +27,7 @@ getconf hardware yes
getconf hardwarefile /var/backups/hardware.txt getconf hardwarefile /var/backups/hardware.txt
# See if vservers are configured # See if vservers are configured
if [ "$VSERVERS" = "yes" ] if [ "$vservers" = "yes" ]
then then
if [ ! -d $VROOTDIR ] if [ ! -d $VROOTDIR ]
then then
......
#
# this handler will backup trac environments (based on the svn handler)
#
# http://trac.edgewall.com/
#
getconf src /var/lib/trac
getconf dest /var/backups/trac
getconf tmp /var/backups/trac.tmp
error=0
cd $src
for repo in `find . -name VERSION`
do
repo=`dirname $repo`
# Just make the $tmp dir, not $tmp/$repo
ret=`mkdir -p $tmp 2>&1`
code=$?
if [ "$ret" ]; then
debug "$ret"
fi
if [ $code != 0 ]; then
error "command failed mkdir -p $tmp"
fi
ret=`trac-admin $src/$repo hotcopy $tmp/$repo 2>&1`
code=$?
if [ "$ret" ]; then
debug "$ret"
fi
if [ $code != 0 ]; then
error "command failed -- trac-admin $src/$repo hotcopy $tmp/$repo"
error=1
fi
done
if [ $error -eq 1 ]; then
echo "Error: because of earlier errors, we are leaving trac backups in $tmp instead of $dest"
else
if [ -d $dest -a -d $tmp ]; then
rm -rf $dest
fi
if [ -d $tmp ]; then
mv $tmp $dest
fi
fi
exit 0
# vim: filetype=sh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment