Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 11293-partition_table_backup
  • borg-custom-init-options
  • borg-sftp-support
  • borg-ssh-keygen
  • bugfix-borg-handler-create-options
  • debian
  • mariaback_full-intial
  • master
  • move-mail-deps
  • nap-initial
  • no_vservers
  • pristine-tar
  • stretch-backports
  • systemd_integration
  • tests
  • upstream
  • backupninja-0.3.4
  • backupninja-0.4.0
  • backupninja-0.4.1
  • backupninja-0.4.2
  • backupninja-0.4.4
  • backupninja-0.5
  • backupninja-0.7
  • backupninja-0.8
  • backupninja-0.9
  • backupninja-0.9.1
  • backupninja-0.9.10
  • backupninja-0.9.2
  • backupninja-0.9.3
  • backupninja-0.9.4
  • backupninja-0.9.5
  • backupninja-0.9.6
  • backupninja-0.9.7
  • backupninja-0.9.8
  • backupninja-0.9.8.1
  • backupninja-0.9.9
  • backupninja-1.0
  • backupninja-1.0-rc1
  • backupninja-1.0.1
  • backupninja-1.0.2
  • backupninja-1.1.0
  • backupninja_debian/0.9.10-1
  • backupninja_debian/0.9.10-2
  • backupninja_debian/0.9.9-1
  • backupninja_debian/1.0-1
  • backupninja_debian/1.0.1-1
  • backupninja_debian/1.0.1-2
  • backupninja_debian/1.0.2-1
  • backupninja_debian/1.0_rc1-1
  • backupninja_debian/1.1.0-1
  • backupninja_upstream/0.9.10
  • backupninja_upstream/1.0
  • backupninja_upstream/1.0.1
  • backupninja_upstream/1.0.2
  • backupninja_upstream/1.0_rc1
  • backupninja_upstream/1.1.0
56 results

Target

Select target project
  • liberate/backupninja
  • Benzhaomin/backupninja
  • ergonlogic/backupninja
  • louis/backupninja
  • guido/backupninja
  • ibauer/backupninja
  • romain/backupninja
  • gsubiron/backupninja
  • davidkg/backupninja
  • fkrauthan/backupninja
  • Glandos/backupninja
  • lyz/backupninja
  • nosmo/backupninja
  • orel/backupninja
  • raabf/backupninja
  • wu-lee/backupninja
  • huthamcau/backupninja
  • julien/backupninja
  • sensespidey/backupninja
  • LeLutin/backupninja
  • raT/backupninja
  • petrklima/backupninja
  • fancsali/backupninja
  • ko7ashiV/backupninja
  • yova/backupninja
  • jipem/backupninja
  • debian-janitor/backupninja
  • phlummox/backupninja
  • e1k/backupninja
  • jonhattan_/backupninja
  • illuusio/backupninja
  • maethor/backupninja
32 results
Select Git revision
  • backupninja.conf.d
  • borg-custom-init-options
  • borg-sftp-support
  • borg-ssh-keygen
  • debian
  • expand_pruning_options
  • maethor-master-patch-46063
  • maethor-master-patch-70558
  • mariaback_full-intial
  • master
  • nap-initial
  • pristine-tar
  • stretch-backports
  • systemd_integration
  • upstream
  • when-override
  • backupninja-0.3.4
  • backupninja-0.4.0
  • backupninja-0.4.1
  • backupninja-0.4.2
  • backupninja-0.4.4
  • backupninja-0.5
  • backupninja-0.7
  • backupninja-0.8
  • backupninja-0.9
  • backupninja-0.9.1
  • backupninja-0.9.10
  • backupninja-0.9.2
  • backupninja-0.9.3
  • backupninja-0.9.4
  • backupninja-0.9.5
  • backupninja-0.9.6
  • backupninja-0.9.7
  • backupninja-0.9.8
  • backupninja-0.9.8.1
  • backupninja-0.9.9
  • backupninja-1.0
  • backupninja-1.0-rc1
  • backupninja-1.0.1
  • backupninja-1.0.2
  • backupninja-1.1.0
  • backupninja-1.2.0
  • backupninja-1.2.0-rc1
  • backupninja-1.2.1
  • backupninja-1.2.2
  • backupninja_debian/0.9.10-1
  • backupninja_debian/0.9.10-2
  • backupninja_debian/0.9.9-1
  • backupninja_debian/1.0-1
  • backupninja_debian/1.0.1-1
  • backupninja_debian/1.0.1-2
  • backupninja_debian/1.0.2-1
  • backupninja_debian/1.0_rc1-1
  • backupninja_debian/1.1.0-1
  • backupninja_debian/1.2.0-1
  • backupninja_debian/1.2.1-1
  • backupninja_debian/1.2.2-1
  • backupninja_upstream/0.9.10
  • backupninja_upstream/1.0
  • backupninja_upstream/1.0.1
  • backupninja_upstream/1.0.2
  • backupninja_upstream/1.0_rc1
  • backupninja_upstream/1.1.0
  • backupninja_upstream/1.2.0
  • backupninja_upstream/1.2.1
  • backupninja_upstream/1.2.2
66 results
Show changes
Commits on Source (1)
Showing with 86 additions and 680 deletions
...@@ -47,7 +47,6 @@ lib/Makefile ...@@ -47,7 +47,6 @@ lib/Makefile
lib/easydialog lib/easydialog
lib/parseini lib/parseini
lib/tools lib/tools
lib/vserver
man/Makefile man/Makefile
src/Makefile src/Makefile
src/backupninja src/backupninja
......
...@@ -24,7 +24,6 @@ The key features of backupninja are: ...@@ -24,7 +24,6 @@ The key features of backupninja are:
- console-based wizard (ninjahelper) makes it easy to create - console-based wizard (ninjahelper) makes it easy to create
backup action configuration files backup action configuration files
- passwords are never sent via the command line to helper programs - passwords are never sent via the command line to helper programs
- works with [Linux-Vservers](http://linux-vserver.org/)
The following backup types are supported: The following backup types are supported:
...@@ -82,8 +81,7 @@ To add an additional 'wizard' to ninjahelper, follow these steps: ...@@ -82,8 +81,7 @@ To add an additional 'wizard' to ninjahelper, follow these steps:
} }
3. Look at the existing helpers to see how they are written. Try to re-use 3. Look at the existing helpers to see how they are written. Try to re-use
functions, such as the dialog functions that are defined in `easydialog.sh`, functions, such as the dialog functions that are defined in `easydialog.sh`.
or the vserver functions defined in `lib/vserver`.
4. Test, re-test, and test again. Try to break the helper by going backwards, 4. Test, re-test, and test again. Try to break the helper by going backwards,
try to think like someone who has no idea how to configure your handler try to think like someone who has no idea how to configure your handler
...@@ -215,25 +213,6 @@ Since it performs incremental backups it minimizes the number of request per ...@@ -215,25 +213,6 @@ Since it performs incremental backups it minimizes the number of request per
operation therefore reducing the costs. The boto Python interface to Amazon operation therefore reducing the costs. The boto Python interface to Amazon
Web Services is needed to use duplicity with S3 (Debian package: `python-boto`). Web Services is needed to use duplicity with S3 (Debian package: `python-boto`).
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 they 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}'`)
.sh configuration files .sh configuration files
----------------------- -----------------------
......
...@@ -72,9 +72,6 @@ usecolors = yes ...@@ -72,9 +72,6 @@ usecolors = yes
# default value for 'when' # default value for 'when'
when = everyday at 01:00 when = everyday at 01:00
# if running vservers, set to yes
vservers = no
# programs paths # programs paths
# SLAPCAT=/usr/sbin/slapcat # SLAPCAT=/usr/sbin/slapcat
# LDAPSEARCH=/usr/bin/ldapsearch # LDAPSEARCH=/usr/bin/ldapsearch
...@@ -89,6 +86,3 @@ vservers = no ...@@ -89,6 +86,3 @@ vservers = no
# GZIP=/bin/gzip # GZIP=/bin/gzip
# GZIP_OPTS='--rsyncable' # GZIP_OPTS='--rsyncable'
# RSYNC=/usr/bin/rsync # RSYNC=/usr/bin/rsync
# VSERVERINFO=/usr/sbin/vserver-info
# VSERVER=/usr/sbin/vserver
# VROOTDIR=/var/lib/vservers
...@@ -127,21 +127,6 @@ include = /usr/local/sbin ...@@ -127,21 +127,6 @@ 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 variables can
## be used:
## vsnames = all | <vserver1> <vserver2> ... (default = all)
## vsinclude = <path>
## vsinclude = <path>
## ...
## Any path specified in vsinclude is added to the include list for each vserver
## listed in vsnames (or all if vsnames = all, which is the default).
##
## For example, vsinclude = /home will backup the /home directory in every
## vserver listed in vsnames. If you have 'vsnames = foo bar baz', this
## vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home
## and /vservers/baz/home.
## Vservers paths are derived from $VROOTDIR.
# files to exclude from the backup # files to exclude from the backup
exclude = /home/*/.gnupg exclude = /home/*/.gnupg
exclude = /var/cache/backupninja/duplicity exclude = /var/cache/backupninja/duplicity
......
...@@ -79,11 +79,3 @@ compress = yes ...@@ -79,11 +79,3 @@ compress = yes
# #
# compress = < yes | no > (default = yes) # compress = < yes | no > (default = yes)
# if yes, compress the sqldump output. # if yes, compress the sqldump output.
#
# vsname = <vserver> (no default)
# 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
#
# NB: databases = all doesn't seem to work with hotcopy = yes
# when vsname is specified, I would like to know how to fix this.
### backupninja PostgreSQL config file ### ### backupninja PostgreSQL config file ###
# vsname = <vserver> (no default)
# 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
# Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir.
# backupdir = <dir> (default: /var/backups/postgres) # backupdir = <dir> (default: /var/backups/postgres)
# where to dump the backups # where to dump the backups
......
...@@ -93,7 +93,7 @@ type = local ...@@ -93,7 +93,7 @@ type = local
# keep = 60 # keep = 60
## A few notes about includes and excludes: ## A few notes about includes and excludes:
## 1. include, exclude and vsinclude statements support globbing with '*' ## 1. include and exclude statements support globbing with '*'
## 2. Symlinks are not dereferenced. Moreover, an include line whose path ## 2. Symlinks are not dereferenced. Moreover, an include line whose path
## contains, at any level, a symlink to a directory, will only have the ## contains, at any level, a symlink to a directory, will only have the
## symlink backed-up, not the target directory's content. Yes, you have to ## symlink backed-up, not the target directory's content. Yes, you have to
...@@ -119,21 +119,6 @@ include = /usr/local/sbin ...@@ -119,21 +119,6 @@ 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 variables can
## be used:
## vsnames = all | <vserver1> <vserver2> ... (default = all)
## vsinclude = <path>
## vsinclude = <path>
## ...
## Any path specified in vsinclude is added to the include list for each vserver
## listed in vsnames (or all if vsnames = all, which is the default).
##
## For example, vsinclude = /home will backup the /home directory in every
## vserver listed in vsnames. If you have 'vsnames = foo bar baz', this
## vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home
## and /vservers/baz/home.
## Vservers paths are derived from $VROOTDIR.
## files to exclude from the backup ## files to exclude from the backup
exclude = /home/*/.gnupg exclude = /home/*/.gnupg
exclude = /var/cache/backupninja/duplicity exclude = /var/cache/backupninja/duplicity
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
# Mandatory options are uncommented with sugested values # Mandatory options are uncommented with sugested values
# Other options are commented out with their default values # Other options are commented out with their default values
# #
# Note: You dont need to manually specify vservers using "include = /vservers".
# They're automatically backuped if vserver is set to "yes" on you backupninja.conf.
[general] [general]
...@@ -111,11 +109,6 @@ include = /var ...@@ -111,11 +109,6 @@ include = /var
exclude = exclude_folder1 exclude = exclude_folder1
exclude = exclude_folder2 exclude = exclude_folder2
# exlude some vserver from backup
# this is used only if vservers = yes on backupninja.conf
exclude_vserver = excluded_vserver1
exclude_vserver = excluded_vserver2
# ssh command line (remote only) # ssh command line (remote only)
#ssh = ssh #ssh = ssh
......
...@@ -21,6 +21,3 @@ ...@@ -21,6 +21,3 @@
## in /usr/share/doc/subversion/examples now if you wish to use ## in /usr/share/doc/subversion/examples now if you wish to use
## it instead ## it instead
# HOTBACKUP = /usr/lib/subversion/hot-backup.py # HOTBACKUP = /usr/lib/subversion/hot-backup.py
## the name of the vserver containing svn, if using vservers
# vsname =
...@@ -79,7 +79,3 @@ ...@@ -79,7 +79,3 @@
# note: to backup your BIOS, you need the program 'flashrom' installed, and your # note: to backup your BIOS, you need the program 'flashrom' installed, and your
# mainboard needs to be supported, see http://flashrom.org/Supported_hardware#Supported_mainboards # mainboard needs to be supported, see http://flashrom.org/Supported_hardware#Supported_mainboards
# bios = no # bios = no
# If vservers = yes in /etc/backupninja.conf then the following variables can
# be used:
# vsnames = all | <vserver1> <vserver2> ... (default = all)
...@@ -30,35 +30,6 @@ do_dup_host_includes() { ...@@ -30,35 +30,6 @@ do_dup_host_includes() {
set +o noglob set +o noglob
} }
do_dup_vserver() {
# choose the vservers to backup (into $selected_vservers)
choose_one_or_more_vservers "$dup_title"
[ $? = 0 ] || return 1
set -o noglob
# choose the files to backup
REPLY=
while [ -z "$REPLY" ]; do
formBegin "$dup_title - vservers: vsincludes (backup these directories from every selected vserver)"
[ -z "$dup_vsincludes" ] && dup_vsincludes="$dup_default_includes"
for i in $dup_vsincludes; do
formItem include "$i"
done
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formDisplay
[ $? = 0 ] || return 1
dup_vsincludes="$REPLY"
done
set +o noglob
}
do_dup_excludes() { do_dup_excludes() {
set -o noglob set -o noglob
formBegin "$dup_title: excludes" formBegin "$dup_title: excludes"
...@@ -80,35 +51,6 @@ do_dup_excludes() { ...@@ -80,35 +51,6 @@ do_dup_excludes() {
set +o noglob set +o noglob
} }
do_dup_src() {
choose_host_or_vservers_or_both "$dup_title"
[ $? = 0 ] || return 1
case $host_or_vservers in
'host')
do_dup_host_includes
[ $? = 0 ] || return 1
;;
'vservers')
do_dup_vserver
[ $? = 0 ] || return 1
;;
'both')
do_dup_host_includes
[ $? = 0 ] || return 1
do_dup_vserver
[ $? = 0 ] || return 1
;;
*)
return 1
;;
esac
do_dup_excludes
[ $? = 0 ] || return 1
_src_done="(DONE)"
setDefault dest
}
do_dup_dest() { do_dup_dest() {
local replyconverted local replyconverted
...@@ -362,7 +304,7 @@ signpassword = $dup_gpg_signpassword ...@@ -362,7 +304,7 @@ signpassword = $dup_gpg_signpassword
[source] [source]
# A few notes about includes and excludes: # A few notes about includes and excludes:
# 1. include, exclude and vsinclude statements support globbing with '*' # 1. include and exclude statements support globbing with '*'
# 2. Symlinks are not dereferenced. Moreover, an include line whose path # 2. Symlinks are not dereferenced. Moreover, an include line whose path
# contains, at any level, a symlink to a directory, will only have the # contains, at any level, a symlink to a directory, will only have the
# symlink backed-up, not the target directory's content. Yes, you have to # symlink backed-up, not the target directory's content. Yes, you have to
...@@ -380,43 +322,12 @@ signpassword = $dup_gpg_signpassword ...@@ -380,43 +322,12 @@ signpassword = $dup_gpg_signpassword
# files to include in the backup # files to include in the backup
EOF EOF
if [ "$host_or_vservers" == host -o "$host_or_vservers" == both ]; then
set -o noglob set -o noglob
for i in $dup_includes; do for i in $dup_includes; do
echo "include = $i" >> $next_filename echo "include = $i" >> $next_filename
done done
set +o noglob set +o noglob
fi
cat >> $next_filename <<EOF
# If vservers = yes in /etc/backupninja.conf then the following variables can
# be used:
# vsnames = all | <vserver1> <vserver2> ... (default = all)
# vsinclude = <path>
# vsinclude = <path>
# ...
# Any path specified in vsinclude is added to the include list for each vserver
# listed in vsnames (or all if vsnames = all, which is the default).
#
# For example, vsinclude = /home will backup the /home directory in every
# vserver listed in vsnames. If you have 'vsnames = foo bar baz', this
# vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home
# and /vservers/baz/home.
# Vservers paths are derived from $VROOTDIR.
EOF
if [ "$host_or_vservers" == vservers -o "$host_or_vservers" == both ]; then
set -o noglob
echo -e "vsnames = $selected_vservers\n" >> $next_filename
for i in $dup_vsincludes; do
echo "vsinclude = $i" >> $next_filename
done
set +o noglob
fi
# excludes
cat >> $next_filename <<EOF cat >> $next_filename <<EOF
# files to exclude from the backup # files to exclude from the backup
...@@ -601,7 +512,6 @@ dup_wizard() { ...@@ -601,7 +512,6 @@ dup_wizard() {
_adv_done= _adv_done=
dup_includes= dup_includes=
dup_excludes= dup_excludes=
dup_vsincludes=
dup_incremental=yes dup_incremental=yes
dup_increments=30 dup_increments=30
dup_keep=60 dup_keep=60
......
...@@ -19,8 +19,6 @@ getconf signkey ...@@ -19,8 +19,6 @@ getconf signkey
setsection source setsection source
getconf include getconf include
getconf vsnames all
getconf vsinclude
getconf exclude getconf exclude
setsection dest setsection dest
...@@ -48,7 +46,7 @@ destdir=${destdir%/} ...@@ -48,7 +46,7 @@ destdir=${destdir%/}
### SANITY CHECKS ############################################################## ### SANITY CHECKS ##############################################################
[ -n "$desturl" -o -n "$destdir" ] || fatal "The destination directory (destdir) must be set when desturl is not used." [ -n "$desturl" -o -n "$destdir" ] || fatal "The destination directory (destdir) must be set when desturl is not used."
[ -n "$include" -o -n "$vsinclude" ] || fatal "No source includes specified" [ -n "$include" ] || fatal "No source includes specified"
[ -n "$password" ] || fatal "The password option must be set." [ -n "$password" ] || fatal "The password option must be set."
if [ -n "$signkey" -a -n "$encryptkey" -a "$signkey" != "$encryptkey" ]; then if [ -n "$signkey" -a -n "$encryptkey" -a "$signkey" != "$encryptkey" ]; then
[ -n "$signpassword" ] || fatal "The signpassword option must be set because signkey is different from encryptkey." [ -n "$signpassword" ] || fatal "The signpassword option must be set because signkey is different from encryptkey."
...@@ -80,25 +78,6 @@ if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "file" ]; then ...@@ -80,25 +78,6 @@ if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "file" ]; then
fi fi
fi fi
### VServers
# If vservers are configured, check that the ones listed in $vsnames do exist.
usevserver=no
if [ $vservers_are_available = yes ]; then
if [ "$vsnames" = all ]; then
vsnames="$found_vservers"
else
if ! vservers_exist "$vsnames" ; then
fatal "At least one of the vservers listed in vsnames ($vsnames) does not exist."
fi
fi
if [ -n "$vsinclude" ]; then
info "Using vservers '$vsnames'"
usevserver=yes
fi
else
[ -z "$vsinclude" ] || warning 'vservers support disabled in backupninja.conf, vsincludes configuration lines will be ignored'
fi
### See if we can login on $desthost ### See if we can login on $desthost
if [ "$testconnect" == "yes" ]; then if [ "$testconnect" == "yes" ]; then
if [ -n "$desturl" ]; then if [ -n "$desturl" ]; then
...@@ -259,20 +238,6 @@ for i in $include; do ...@@ -259,20 +238,6 @@ for i in $include; do
done done
IFS=$SAVEIFS IFS=$SAVEIFS
# vsincludes
if [ $usevserver = yes ]; then
for vserver in $vsnames; do
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for vi in $vsinclude; do
str="${vi//__star__/*}"
str="$VROOTDIR/$vserver$str"
execstr_source="${execstr_source} --include '$str'"
done
IFS=$SAVEIFS
done
fi
set +o noglob set +o noglob
### EXECUTE #################################################################### ### EXECUTE ####################################################################
......
...@@ -3,12 +3,6 @@ ...@@ -3,12 +3,6 @@
HELPERS="$HELPERS mysql:mysql_database_backup" HELPERS="$HELPERS mysql:mysql_database_backup"
do_mysql_vserver() {
choose_one_vserver "$mysql_title"
[ $? = 0 ] || return 1
mysql_vsname="vsname = $REPLY"
}
do_mysql_databases() { do_mysql_databases() {
REPLY= REPLY=
while [ -z "$REPLY" ]; do while [ -z "$REPLY" ]; do
...@@ -121,20 +115,6 @@ $mysql_databases ...@@ -121,20 +115,6 @@ $mysql_databases
EOF EOF
if [ $host_or_vservers == vservers ]
then
cat >> $next_filename <<EOF
#
# vsname = <vserver> (no default)
# vsname indicates which vserver to operate on, this is only used if
# vserver is set to yes in /etc/backupninja.conf
# NOTE: if you do not specify a vsname the host will be operated on
# alsoNOTE: if operating on a vserver, $VROOTDIR will be
# prepended to backupdir.
EOF
echo -e "$mysql_vsname\n" >> $next_filename
fi
echo -e $@ >> $next_filename echo -e $@ >> $next_filename
chmod 600 $next_filename chmod 600 $next_filename
...@@ -145,22 +125,8 @@ mysql_wizard() { ...@@ -145,22 +125,8 @@ mysql_wizard() {
# Global variables # Global variables
mysql_title="MySQL action wizard" mysql_title="MySQL action wizard"
# backup the host system or a Vserver?
choose_host_or_one_vserver "$mysql_title"
[ $? = 0 ] || return 1
if [ $host_or_vservers == vservers ]
then
do_mysql_vserver
[ $? = 0 ] || return 1
fi
# backupdir # backupdir
if [ $host_or_vservers == vservers ]
then
inputBox "$mysql_title" "Directory where to store the backups:`echo \"\n(Relative to chosen vserver's root directory)\"`" "/var/backups/mysql"
else
inputBox "$mysql_title" "Directory where to store the backups" "/var/backups/mysql" inputBox "$mysql_title" "Directory where to store the backups" "/var/backups/mysql"
fi
[ $? = 1 ] && return [ $? = 1 ] && return
mysql_backupdir="backupdir = $REPLY" mysql_backupdir="backupdir = $REPLY"
......
...@@ -13,7 +13,6 @@ getconf hotcopy no ...@@ -13,7 +13,6 @@ getconf hotcopy no
getconf sqldump no getconf sqldump no
getconf sqldumpoptions "--lock-tables --complete-insert --add-drop-table --quick --quote-names" getconf sqldumpoptions "--lock-tables --complete-insert --add-drop-table --quick --quote-names"
getconf compress yes getconf compress yes
getconf vsname
# authentication: # authentication:
getconf user getconf user
...@@ -22,27 +21,6 @@ getconf dbpassword ...@@ -22,27 +21,6 @@ getconf dbpassword
getconf configfile /etc/mysql/debian.cnf getconf configfile /etc/mysql/debian.cnf
# Decide if the handler should operate on a vserver or on the host.
# In the former case, check that $vsname exists and is running.
usevserver=no
vroot=''
if [ $vservers_are_available = yes ]; then
if [ -n "$vsname" ]; then
# does it exist ?
if ! vservers_exist "$vsname" ; then
fatal "The vserver given in vsname ($vsname) does not exist."
fi
# is it running ?
vservers_running $vsname || fatal "The vserver $vsname is not running."
# everything ok
info "Using vserver '$vsname'."
usevserver=yes
vroot="$VROOTDIR/$vsname"
else
info "No vserver name specified, actions will be performed on the host."
fi
fi
## Prepare ignore part of the command ## Prepare ignore part of the command
## This only works for mysqldump at the moment ## This only works for mysqldump at the moment
...@@ -51,21 +29,15 @@ for i in $ignores $nodata; do ...@@ -51,21 +29,15 @@ for i in $ignores $nodata; do
ignore="$ignore --ignore-table=$i" ignore="$ignore --ignore-table=$i"
done done
# create backup dirs, $vroot will be empty if no vsname was specified # create backup dirs
# and we will instead proceed to operate on the host # and we will instead proceed to operate on the host
[ -d $vroot$backupdir ] || mkdir -p $vroot$backupdir [ -d $backupdir ] || mkdir -p $backupdir
[ -d $vroot$backupdir ] || fatal "Backup directory '$vroot$backupdir'" [ -d $backupdir ] || fatal "Backup directory '$backupdir'"
hotdir="$backupdir/hotcopy" hotdir="$backupdir/hotcopy"
dumpdir="$backupdir/sqldump" dumpdir="$backupdir/sqldump"
if [ $usevserver = yes ]
then
[ "$sqldump" == "no" -o -d $vroot$dumpdir ] || $VSERVER $vsname exec mkdir -p $dumpdir
[ "$hotcopy" == "no" -o -d $vroot$hotdir ] || $VSERVER $vsname exec mkdir -p $hotdir
else
[ "$sqldump" == "no" -o -d $dumpdir ] || mkdir -p $dumpdir [ "$sqldump" == "no" -o -d $dumpdir ] || mkdir -p $dumpdir
[ "$hotcopy" == "no" -o -d $hotdir ] || mkdir -p $hotdir [ "$hotcopy" == "no" -o -d $hotdir ] || mkdir -p $hotdir
fi
####################################################################### #######################################################################
## AUTHENTICATION ## AUTHENTICATION
...@@ -88,23 +60,13 @@ defaultsfile="" ...@@ -88,23 +60,13 @@ defaultsfile=""
if [ -n "$dbusername" -a -n "$dbpassword" ] if [ -n "$dbusername" -a -n "$dbpassword" ]
then then
if [ $usevserver = yes ]
then
home=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'`
else
home=`getent passwd "root" | @AWK@ -F: '{print $6}'` home=`getent passwd "root" | @AWK@ -F: '{print $6}'`
fi
[ -d $home ] || fatal "Can't find root's home directory ($home)." [ -d $home ] || fatal "Can't find root's home directory ($home)."
mycnf="$home/.my.cnf" mycnf="$home/.my.cnf"
if [ $usevserver = yes ]
then
workcnf="$vroot$mycnf"
else
workcnf="$mycnf" workcnf="$mycnf"
fi
if [ -f $workcnf ] if [ -f $workcnf ]
then then
...@@ -145,16 +107,7 @@ EOF ...@@ -145,16 +107,7 @@ EOF
elif [ -n "$user" ] elif [ -n "$user" ]
then then
userset=true; userset=true;
if [ $usevserver = yes ]
then
userhome=`$VSERVER $vsname exec getent passwd "$user" | @AWK@ -F: '{print $6}'`
if [ $? -eq 2 ]
then
fatal "User $user not found in /etc/passwd"
fi
debug "User home set to: $vroot$userhome"
[ -f $vroot$userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
else
userhome=`getent passwd "$user" | @AWK@ -F: '{print $6}'` userhome=`getent passwd "$user" | @AWK@ -F: '{print $6}'`
if [ $? -eq 2 ] if [ $? -eq 2 ]
then then
...@@ -162,7 +115,6 @@ then ...@@ -162,7 +115,6 @@ then
fi fi
debug "User home set to: $userhome" debug "User home set to: $userhome"
[ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
fi
defaultsfile="--defaults-extra-file=$userhome/.my.cnf" defaultsfile="--defaults-extra-file=$userhome/.my.cnf"
debug "using $defaultsfile" debug "using $defaultsfile"
...@@ -180,13 +132,7 @@ then ...@@ -180,13 +132,7 @@ then
info "Initializing hotcopy method" info "Initializing hotcopy method"
if [ "$databases" == "all" ] if [ "$databases" == "all" ]
then then
if [ $usevserver = yes ]
then
info "dbhost: $dbhost"
execstr="$VSERVER $vsname exec $MYSQLHOTCOPY -h $dbhost --quiet --allowold --regexp /.\*/./.\*/ $hotdir"
else
execstr="$MYSQLHOTCOPY --quiet --allowold --regexp /.\*/./.\*/ $hotdir" execstr="$MYSQLHOTCOPY --quiet --allowold --regexp /.\*/./.\*/ $hotdir"
fi
debug "su $user -c \"$execstr\"" debug "su $user -c \"$execstr\""
if [ ! $test ] if [ ! $test ]
then then
...@@ -204,12 +150,7 @@ then ...@@ -204,12 +150,7 @@ then
else else
for db in $databases for db in $databases
do do
if [ $usevserver = yes ]
then
execstr="$VSERVER $vsname exec $MYSQLHOTCOPY --allowold $db $hotdir"
else
execstr="$MYSQLHOTCOPY --allowold $db $hotdir" execstr="$MYSQLHOTCOPY --allowold $db $hotdir"
fi
debug 'su $user -c \"$execstr\"' debug 'su $user -c \"$execstr\"'
if [ ! $test ] if [ ! $test ]
then then
...@@ -236,22 +177,12 @@ then ...@@ -236,22 +177,12 @@ then
info "Initializing SQL dump method" info "Initializing SQL dump method"
if [ "$databases" == "all" ] if [ "$databases" == "all" ]
then then
if [ $usevserver = yes ]
then
debug 'set -o pipefail ; echo show databases | $VSERVER $vsname exec su $user -c \"$MYSQL $defaultsfile\" | grep -v Database | grep -v '"'"'^\(information\|performance\)_schema$'"'"
databases=`set -o pipefail ; echo 'show databases' | $VSERVER $vsname exec su $user -c "$MYSQL $defaultsfile" | grep -v Database | grep -v '^\(information\|performance\)_schema$'`
if [ $? -ne 0 ]
then
fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?"
fi
else
databases=$(set -o pipefail ; su $user -c "$MYSQL $defaultsfile -N -B -e 'show databases'" | sed 's/|//g;/\+----/d;/^\(information\|performance\)_schema$/d') databases=$(set -o pipefail ; su $user -c "$MYSQL $defaultsfile -N -B -e 'show databases'" | sed 's/|//g;/\+----/d;/^\(information\|performance\)_schema$/d')
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?" fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?"
fi fi
fi fi
fi
for db in $databases for db in $databases
do do
...@@ -275,19 +206,7 @@ then ...@@ -275,19 +206,7 @@ then
done done
DUMP="( $DUMP; $DUMP_STRUCT )" DUMP="( $DUMP; $DUMP_STRUCT )"
fi fi
if [ $usevserver = yes ]
then
# Test to make sure mysqld is running, if it is not sqldump will not work
$VSERVER $vsname exec su $user -c "$MYSQLADMIN $defaultsfile ping 2>&1 >/dev/null"
if [ $? -ne 0 ]; then
fatal "mysqld doesn't appear to be running!"
fi
if [ "$compress" == "yes" ]; then
execstr="$VSERVER $vsname exec $DUMP | $GZIP $GZIP_OPTS > '$vroot$dumpdir/${db}.sql.gz'"
else
execstr="$VSERVER $vsname exec $DUMP -r '$vroot$dumpdir/${db}.sql'"
fi
else
# Test to make sure mysqld is running, if it is not sqldump will not work # Test to make sure mysqld is running, if it is not sqldump will not work
su $user -c "$MYSQLADMIN $defaultsfile ping 2>&1 >/dev/null" su $user -c "$MYSQLADMIN $defaultsfile ping 2>&1 >/dev/null"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
...@@ -298,8 +217,8 @@ then ...@@ -298,8 +217,8 @@ then
else else
execstr="$DUMP > '$dumpdir/${db}.sql'" execstr="$DUMP > '$dumpdir/${db}.sql'"
fi fi
fi
debug "su $user -c \"$execstr\"" debug "su $user -c \"$execstr\""
if [ ! $test ] if [ ! $test ]
then then
output=`su $user -s /bin/bash -c "set -o pipefail ; $execstr" 2>&1` output=`su $user -s /bin/bash -c "set -o pipefail ; $execstr" 2>&1`
......
...@@ -3,12 +3,6 @@ ...@@ -3,12 +3,6 @@
HELPERS="$HELPERS pgsql:postgresql_database_backup" HELPERS="$HELPERS pgsql:postgresql_database_backup"
do_pgsql_vserver() {
choose_one_vserver "$pgsql_title"
[ $? = 0 ] || return 1
pgsql_vsname="vsname = $REPLY"
}
do_pgsql_databases() { do_pgsql_databases() {
REPLY= REPLY=
while [ -z "$REPLY" ]; do while [ -z "$REPLY" ]; do
...@@ -37,16 +31,8 @@ pgsql_wizard() { ...@@ -37,16 +31,8 @@ pgsql_wizard() {
# constants # constants
pgsql_title="PostgreSQL action wizard" pgsql_title="PostgreSQL action wizard"
# backup the host system or a Vserver?
choose_host_or_one_vserver "$pgsql_title"
[ $? = 0 ] || return 1
if [ $host_or_vservers == vservers ]; then
do_pgsql_vserver
[ $? = 0 ] || return 1
fi
# backupdir # backupdir
inputBox "$pgsql_title" "Directory where to store the backups:`[ -z \"$pgsql_vsname\" ] || echo \"\n(In respect to chosen vserver's root directory)\"`" "/var/backups/postgres" inputBox "$pgsql_title" "Directory where to store the backups:" "/var/backups/postgres"
[ $? = 1 ] && return [ $? = 1 ] && return
pgsql_backupdir="backupdir = $REPLY" pgsql_backupdir="backupdir = $REPLY"
...@@ -87,16 +73,6 @@ pgsql_wizard() { ...@@ -87,16 +73,6 @@ pgsql_wizard() {
cat >> $next_filename <<EOF cat >> $next_filename <<EOF
### backupninja PostgreSQL config file ### ### backupninja PostgreSQL config file ###
# vsname = <vserver> (no default)
# 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
# Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir.
EOF
if [ $host_or_vservers == vservers ]; then
echo -e "$pgsql_vsname\n" >> $next_filename
fi
cat >> $next_filename <<EOF
# backupdir = <dir> (default: /var/backups/postgres) # backupdir = <dir> (default: /var/backups/postgres)
# where to dump the backups # where to dump the backups
$pgsql_backupdir $pgsql_backupdir
......
...@@ -7,51 +7,12 @@ ...@@ -7,51 +7,12 @@
getconf backupdir /var/backups/postgres getconf backupdir /var/backups/postgres
getconf databases all getconf databases all
getconf compress yes getconf compress yes
getconf vsname
# format maps to pg_dump --format= option, old/default was plain # format maps to pg_dump --format= option, old/default was plain
getconf format plain getconf format plain
localhost=`hostname` localhost=`hostname`
# Decide if the handler should operate on a vserver or on the host.
# In the former case, check that $vsname exists and is running.
usevserver=no
vroot=''
if [ $vservers_are_available = yes ]; then
if [ -n "$vsname" ]; then
# does it exist ?
if ! vservers_exist "$vsname" ; then
fatal "The vserver given in vsname ($vsname) does not exist."
fi
# is it running ?
vservers_running $vsname || fatal "The vserver $vsname is not running."
# everything ok
info "Using vserver '$vsname'."
usevserver=yes
vroot="$VROOTDIR/$vsname"
else
info "No vserver name specified, actions will be performed on the host."
fi
fi
# Make sure that the system to backup has the needed executables # Make sure that the system to backup has the needed executables
if [ $usevserver = yes ]; then
debug "Examining vserver '$vsname'."
if [ "$databases" == "all" ] && [ "$format" = "plain" ]; then
[ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMPALL`" ] || \
fatal "Can't find $PGSQLDUMPALL in vserver $vsname."
elif [ "$format" != "plain" ]; then
[ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMPALL`" ] || \
fatal "Can't find $PGSQLDUMPALL in vserver $vsname."
[ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMP`" ] || \
fatal "Can't find $PGSQLDUMP in vserver $vsname."
[ -x "$vroot`$VSERVER $vsname exec which $PSQL`" ] || \
fatal "Can't find $PSQL in vserver $vsname."
else
[ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMP`" ] || \
fatal "Can't find $PGSQLDUMP in vserver $vsname."
fi
else
if [ "$databases" == "all" ] && [ "$format" = "plain" ]; then if [ "$databases" == "all" ] && [ "$format" = "plain" ]; then
[ -x "`which $PGSQLDUMPALL`" ] || \ [ -x "`which $PGSQLDUMPALL`" ] || \
fatal "Can't find $PGSQLDUMPALL." fatal "Can't find $PGSQLDUMPALL."
...@@ -66,26 +27,19 @@ else ...@@ -66,26 +27,19 @@ else
[ -x "`which $PGSQLDUMP`" ] || \ [ -x "`which $PGSQLDUMP`" ] || \
fatal "Can't find $PGSQLDUMP." fatal "Can't find $PGSQLDUMP."
fi fi
fi
# create backup dir, the vroot variable will be empty if no vsname was specified # create backup dir
# and will proceed to operate on the host [ -d $backupdir ] || (debug "mkdir -p $backupdir"; mkdir -p $backupdir)
[ -d $vroot$backupdir ] || (debug "mkdir -p $vroot$backupdir"; mkdir -p $vroot$backupdir) [ -d $backupdir ] || fatal "Backup directory '$backupdir' does not exist, and could not be created."
[ -d $vroot$backupdir ] || fatal "Backup directory '$vroot$backupdir' does not exist, and could not be created."
# give backup dir the good uid and permissions # give backup dir the good uid and permissions
# (in respect to the vserver, if $usevserver = yes)
if [ $usevserver = yes ]; then
pguid=`$VSERVER $vsname exec getent passwd $PGSQLUSER | @AWK@ -F: '{print $3}'`
else
pguid=`getent passwd $PGSQLUSER | @AWK@ -F: '{print $3}'` pguid=`getent passwd $PGSQLUSER | @AWK@ -F: '{print $3}'`
fi [ -n "$pguid" ] || fatal "No user called $PGSQLUSER."
[ -n "$pguid" ] || \
fatal "No user called $PGSQLUSER`[ $usevserver = no ] || echo \" on vserver $vsname\"`." debug "chown $pguid $backupdir"
debug "chown $pguid $vroot$backupdir" chown $pguid $backupdir
chown $pguid $vroot$backupdir debug "chmod 700 $backupdir"
debug "chmod 700 $vroot$backupdir" chmod 700 $backupdir
chmod 700 $vroot$backupdir
# If we are using the custom (best) or tar pg_dump format, and # If we are using the custom (best) or tar pg_dump format, and
...@@ -93,11 +47,7 @@ chmod 700 $vroot$backupdir ...@@ -93,11 +47,7 @@ chmod 700 $vroot$backupdir
# of all non-template databases to avoid the use of pg_dumpall. # of all non-template databases to avoid the use of pg_dumpall.
dumpglobals="no" dumpglobals="no"
if [ "$databases" = "all" ] && [ "$format" != "plain" ]; then if [ "$databases" = "all" ] && [ "$format" != "plain" ]; then
cmdprefix="" execstr="su - $PGSQLUSER -c 'psql -AtU $PGSQLUSER -c \"SELECT datname FROM pg_database WHERE NOT datistemplate\"'"
if [ "$usevserver" = "yes" ]; then
cmdprefix="$VSERVER $vsname exec "
fi
execstr="${cmdprefix} su - $PGSQLUSER -c 'psql -AtU $PGSQLUSER -c \"SELECT datname FROM pg_database WHERE NOT datistemplate\"'"
debug execstr debug execstr
dblist="" dblist=""
for db in $(eval $execstr 2>&1); do for db in $(eval $execstr 2>&1); do
...@@ -113,19 +63,11 @@ fi ...@@ -113,19 +63,11 @@ fi
# if $databases = all, use pg_dumpall # if $databases = all, use pg_dumpall
if [ "$databases" == "all" ]; then if [ "$databases" == "all" ]; then
if [ $usevserver = yes ]; then
if [ "$compress" == "yes" ]; then
execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${vsname}.sql.gz'\""
else
execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${vsname}.sql'\""
fi
else
if [ "$compress" == "yes" ]; then if [ "$compress" == "yes" ]; then
execstr="su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${localhost}-all.sql.gz'\"" execstr="su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${localhost}-all.sql.gz'\""
else else
execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\"" execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\""
fi fi
fi
debug "$execstr" debug "$execstr"
if [ ! $test ]; then if [ ! $test ]; then
output=`eval $execstr 2>&1` output=`eval $execstr 2>&1`
...@@ -151,11 +93,7 @@ else ...@@ -151,11 +93,7 @@ else
else else
globalscmd="$PGSQLDUMPALL -g > '$backupdir/globals.sql'" globalscmd="$PGSQLDUMPALL -g > '$backupdir/globals.sql'"
fi fi
if [ $usevserver = yes ]; then
execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"$globalscmd\""
else
execstr="su - $PGSQLUSER -s /bin/bash -c \"$globalscmd\"" execstr="su - $PGSQLUSER -s /bin/bash -c \"$globalscmd\""
fi
debug "$execstr" debug "$execstr"
if [ ! $test ]; then if [ ! $test ]; then
output=`eval $execstr 2>&1` output=`eval $execstr 2>&1`
...@@ -188,11 +126,7 @@ else ...@@ -188,11 +126,7 @@ else
else else
dumpcmd="$PGSQLDUMP --format=$format ${disablecustomcompress} $db > '$backupdir/${db}.${dumpext}'" dumpcmd="$PGSQLDUMP --format=$format ${disablecustomcompress} $db > '$backupdir/${db}.${dumpext}'"
fi fi
if [ $usevserver = yes ]; then
execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"$dumpcmd\""
else
execstr="su - $PGSQLUSER -s /bin/bash -c \"$dumpcmd\"" execstr="su - $PGSQLUSER -s /bin/bash -c \"$dumpcmd\""
fi
debug "$execstr" debug "$execstr"
if [ ! $test ]; then if [ ! $test ]; then
output=`eval $execstr 2>&1` output=`eval $execstr 2>&1`
......
...@@ -5,8 +5,6 @@ HELPERS="$HELPERS rdiff:incremental_remote_filesystem_backup" ...@@ -5,8 +5,6 @@ HELPERS="$HELPERS rdiff:incremental_remote_filesystem_backup"
declare -a rdiff_includes declare -a rdiff_includes
declare -a rdiff_excludes declare -a rdiff_excludes
declare -a rdiff_vsincludes
declare -a rdiff_vsexcludes
# FUNCTIONS # FUNCTIONS
...@@ -35,38 +33,6 @@ do_rdiff_host_includes() { ...@@ -35,38 +33,6 @@ do_rdiff_host_includes() {
set +o noglob set +o noglob
} }
do_rdiff_vserver() {
# choose the vservers to backup (into $selected_vservers)
choose_one_or_more_vservers "$rdiff_title"
[ $? = 0 ] || return 1
set -o noglob
# choose the files to backup
REPLY=
while [ -z "$REPLY" ]; do
formBegin "$rdiff_title - vsincludes (backup these directories from every vserver)"
[ -z "$rdiff_vsincludes" ] && rdiff_vsincludes="$rdiff_default_includes"
for i in $rdiff_vsincludes; do
formItem include "$i"
done
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formItem include ""
formDisplay
[ $? = 0 ] || return 1
rdiff_vsincludes=($REPLY)
done
set +o noglob
}
do_rdiff_excludes() { do_rdiff_excludes() {
set -o noglob set -o noglob
formBegin "$rdiff_title: excludes" formBegin "$rdiff_title: excludes"
...@@ -90,27 +56,8 @@ do_rdiff_excludes() { ...@@ -90,27 +56,8 @@ do_rdiff_excludes() {
} }
do_rdiff_src() { do_rdiff_src() {
choose_host_or_vservers_or_both "$rdiff_title"
[ $? = 0 ] || return 1
case $host_or_vservers in
'host')
do_rdiff_host_includes do_rdiff_host_includes
[ $? = 0 ] || return 1 [ $? = 0 ] || return 1
;;
'vservers')
do_rdiff_vserver
[ $? = 0 ] || return 1
;;
'both')
do_rdiff_host_includes
[ $? = 0 ] || return 1
do_rdiff_vserver
[ $? = 0 ] || return 1
;;
*)
return 1
;;
esac
do_rdiff_excludes do_rdiff_excludes
[ $? = 0 ] || return 1 [ $? = 0 ] || return 1
_src_done="(DONE)" _src_done="(DONE)"
...@@ -314,7 +261,7 @@ type = local ...@@ -314,7 +261,7 @@ type = local
keep = $rdiff_keep keep = $rdiff_keep
# A few notes about includes and excludes: # A few notes about includes and excludes:
# 1. include, exclude and vsinclude statements support globbing with '*' # 1. include and exclude statements support globbing with '*'
# 2. Symlinks are not dereferenced. Moreover, an include line whose path # 2. Symlinks are not dereferenced. Moreover, an include line whose path
# contains, at any level, a symlink to a directory, will only have the # contains, at any level, a symlink to a directory, will only have the
# symlink backed-up, not the target directory's content. Yes, you have to # symlink backed-up, not the target directory's content. Yes, you have to
...@@ -332,40 +279,11 @@ keep = $rdiff_keep ...@@ -332,40 +279,11 @@ keep = $rdiff_keep
# files to include in the backup # files to include in the backup
EOF EOF
## includes ## ## includes ##
if [ "$host_or_vservers" == host -o "$host_or_vservers" == both ]; then
set -o noglob set -o noglob
for ((i=0; i < ${#rdiff_includes[@]} ; i++)); do for ((i=0; i < ${#rdiff_includes[@]} ; i++)); do
echo "include = ${rdiff_includes[$i]}" >> $next_filename echo "include = ${rdiff_includes[$i]}" >> $next_filename
done done
set +o noglob set +o noglob
fi
if [ "$host_or_vservers" == vservers -o "$host_or_vservers" == both ]; then
cat >> $next_filename <<EOF
#
# If vservers = yes in /etc/backupninja.conf then the following variables can
# be used:
# vsnames = all | <vserver1> <vserver2> ... (default = all)
# vsinclude = <path>
# vsinclude = <path>
# ...
# Any path specified in vsinclude is added to the include list for each vserver
# listed in vsnames (or all if vsnames = all, which is the default).
#
# For example, vsinclude = /home will backup the /home directory in every
# vserver listed in vsnames. If you have 'vsnames = foo bar baz', this
# vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home
# and /vservers/baz/home.
# Vservers paths are derived from $VROOTDIR.
EOF
set -o noglob
echo -e "vsnames = $selected_vservers\n" >> $next_filename
for i in $rdiff_vsincludes; do
echo "vsinclude = $i" >> $next_filename
done
set +o noglob
fi
## excludes ## ## excludes ##
set -o noglob set -o noglob
...@@ -439,7 +357,6 @@ rdiff_wizard() { ...@@ -439,7 +357,6 @@ rdiff_wizard() {
set -o noglob set -o noglob
rdiff_includes=(/var/spool/cron/crontabs /var/backups /etc /root /home /usr/local/*bin /var/lib/dpkg/status*) rdiff_includes=(/var/spool/cron/crontabs /var/backups /etc /root /home /usr/local/*bin /var/lib/dpkg/status*)
rdiff_excludes=(/home/*/.gnupg /home/*/.local/share/Trash /home/*/.Trash /home/*/.thumbnails /home/*/.beagle /home/*/.aMule /home/*/gtk-gnutella-downloads /var/cache/backupninja/duplicity) rdiff_excludes=(/home/*/.gnupg /home/*/.local/share/Trash /home/*/.Trash /home/*/.thumbnails /home/*/.beagle /home/*/.aMule /home/*/gtk-gnutella-downloads /var/cache/backupninja/duplicity)
rdiff_vsincludes=
set +o noglob set +o noglob
rdiff_main_menu rdiff_main_menu
......
...@@ -115,24 +115,6 @@ fi ...@@ -115,24 +115,6 @@ fi
### CHECK CONFIG ### ### CHECK CONFIG ###
# If vservers are configured, check that the ones listed in $vsnames do exist.
usevserver=no
if [ $vservers_are_available = yes ]; then
if [ "$vsnames" = all ]; then
vsnames="$found_vservers"
else
if ! vservers_exist "$vsnames" ; then
fatal "At least one of the vservers listed in vsnames ($vsnames) does not exist."
fi
fi
if [ -n "$vsinclude" ]; then
info "Using vservers '$vsnames'"
usevserver=yes
fi
else
[ -z "$vsinclude" ] || warning 'vservers support disabled in backupninja.conf, vsincludes configuration lines will be ignored'
fi
# check the connection at the source and destination # check the connection at the source and destination
[ -n "$test" ] || test=0 [ -n "$test" ] || test=0
if [ "$testconnect" = "yes" ] || [ "${test}" -eq 1 ]; then if [ "$testconnect" = "yes" ] || [ "${test}" -eq 1 ]; then
...@@ -243,24 +225,6 @@ for i in $include; do ...@@ -243,24 +225,6 @@ for i in $include; do
done done
IFS=$SAVEIFS IFS=$SAVEIFS
# vsinclude
if [ $usevserver = yes ]; then
for vserver in $vsnames; do
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for vi in $vsinclude; do
str="${vi//__star__/*}"
str="$VROOTDIR/$vserver$str"
if [ -n "$str" ]; then
execstr="${execstr}--include '$str' "
else
warning "vsinclude statement '${vi//__star__/*}' will be ignored for VServer $vserver. $symlinks_warning"
fi
done
IFS=$SAVEIFS
done
fi
set +o noglob set +o noglob
# exclude everything else # exclude everything else
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
# protocol = ssh or rsync (remote source only) # protocol = ssh or rsync (remote source only)
# rsync = rsync program # rsync = rsync program
# rsync_options = rsync command options # rsync_options = rsync command options
# exclude_vserver = vserver-name (valid only if vservers = yes on backupninja.conf)
# numericids = when set to 1, use numeric ids instead of user/group mappings on rsync # numericids = when set to 1, use numeric ids instead of user/group mappings on rsync
# compress = if set to 1, compress data on rsync (remote source only) # compress = if set to 1, compress data on rsync (remote source only)
# bandwidthlimit = set a bandwidth limit in KB/s (remote source only) # bandwidthlimit = set a bandwidth limit in KB/s (remote source only)
...@@ -97,9 +96,6 @@ ...@@ -97,9 +96,6 @@
# mv = mv command # mv = mv command
# fsck = fsck command # fsck = fsck command
# #
# You dont need to manually specify vservers using "include = /vservers".
# They are automatically backuped if vserver is set to "yes" on you backupninja.conf.
#
# function definitions # function definitions
...@@ -173,7 +169,6 @@ function eval_config { ...@@ -173,7 +169,6 @@ function eval_config {
getconf filelistbase getconf filelistbase
getconf include getconf include
getconf exclude getconf exclude
getconf exclude_vserver
getconf numericids 0 getconf numericids 0
getconf compress 0 getconf compress 0
...@@ -975,8 +970,6 @@ function set_rsync_options { ...@@ -975,8 +970,6 @@ function set_rsync_options {
rsync_options=($rsync_options --rsync-path="$remote_rsync") rsync_options=($rsync_options --rsync-path="$remote_rsync")
fi fi
include_vservers
} }
function stop_services { function stop_services {
...@@ -1050,33 +1043,6 @@ function run_fsck { ...@@ -1050,33 +1043,6 @@ function run_fsck {
} }
function include_vservers {
# add vservers to included folders
if [ "$vservers_are_available" == "yes" ]; then
# sane permission on backup
mkdir -p $backupdir/$VROOTDIR
chmod 000 $backupdir/$VROOTDIR
for candidate in $found_vservers; do
candidate="`basename $candidate`"
found_excluded_vserver="0"
for excluded_vserver in $exclude_vserver; do
if [ "$excluded_vserver" == "$candidate" ]; then
found_excluded_vserver="1"
break
fi
done
if [ "$found_excluded_vserver" == "0" ]; then
include="$include $VROOTDIR/$candidate"
fi
done
fi
}
function start_mux { function start_mux {
if [ "$multiconnection" == "yes" ]; then if [ "$multiconnection" == "yes" ]; then
......
...@@ -12,66 +12,40 @@ getconf vsname ...@@ -12,66 +12,40 @@ getconf vsname
error=0 error=0
# Decide if the handler should operate on a vserver or on the host. cd $src
# In the former case, check that $vsname exists and is running.
usevserver=no
vroot=''
if [ $vservers_are_available = yes ]; then
if [ -n "$vsname" ]; then
# does it exist ?
if ! vservers_exist "$vsname" ; then
fatal "The vserver given in vsname ($vsname) does not exist."
fi
# is it running ?
vservers_running $vsname || fatal "The vserver $vsname is not running."
# everything ok
info "Using vserver '$vsname'."
usevserver=yes
vroot="$VROOTDIR/$vsname"
else
info "No vserver name specified, actions will be performed on the host."
fi
fi
cd $vroot$src
for repo in `find . -name svnserve.conf` for repo in `find . -name svnserve.conf`
do do
repo=`dirname $repo` repo=`dirname $repo`
repo=`dirname $repo` repo=`dirname $repo`
ret=`mkdir -p $vroot$tmp/$repo 2>&1` ret=`mkdir -p $tmp/$repo 2>&1`
code=$? code=$?
if [ "$ret" ]; then if [ "$ret" ]; then
debug "$ret" debug "$ret"
fi fi
if [ $code != 0 ]; then if [ $code != 0 ]; then
error "command failed mkdir -p $vroot$tmp/$repo" error "command failed mkdir -p $tmp/$repo"
fi fi
if [ $usevserver = yes ]
then
ret=`$VSERVER $vsname exec $HOTBACKUP $src/$repo $tmp/$repo 2>&1`
else
ret=`$HOTBACKUP $src/$repo $tmp/$repo 2>&1` ret=`$HOTBACKUP $src/$repo $tmp/$repo 2>&1`
fi
code=$? code=$?
if [ "$ret" ]; then if [ "$ret" ]; then
debug "$ret" debug "$ret"
fi fi
if [ $code != 0 ]; then if [ $code != 0 ]; then
error "command failed -- $HOTBACKUP $vroot$src/$repo $vroot$tmp/$repo" error "command failed -- $HOTBACKUP $src/$repo $tmp/$repo"
error=1 error=1
fi fi
done done
if [ $error -eq 1 ]; then if [ $error -eq 1 ]; then
echo "Error: because of earlier errors, we are leaving svn backups in $vroot$tmp instead of $vroot$dest" echo "Error: because of earlier errors, we are leaving svn backups in $tmp instead of $dest"
else else
if [ -d $vroot$dest -a -d $vroot$tmp ]; then if [ -d $dest -a -d $tmp ]; then
rm -rf $vroot$dest rm -rf $dest
fi fi
if [ -d $vroot$tmp ]; then if [ -d $tmp ]; then
mv $vroot$tmp $vroot$dest mv $tmp $dest
fi fi
fi fi
......