diff --git a/AUTHORS b/AUTHORS index d50e69d90c00296a0a8008656cdb0cdfc90f2640..a4a5fa50e6ed61d2b38b9c98697d760a5fea8049 100644 --- a/AUTHORS +++ b/AUTHORS @@ -39,3 +39,5 @@ Jordi Mallach <jordi@debian.org> -- do not error when no jobs are configured Jacob Anawalt <jlanawalt@gmail.com> -- pg_dump format option Sergio Talens-Oliag <sto@debian.org> -- pipefail fixes Bruno Bigras <bigras.bruno@gmail.com> -- enable tar handler in the build system +aihtdikh -- Allow 'when = XXX' with spaces in .sh files. +Chris Lamb <lamby@debian.org> -- rdiff.helper bugfix diff --git a/ChangeLog b/ChangeLog index f4a38f5be597d70204d6d462500968368c1ab05f..feeb8c52ee6ca65839a395c83a551f2d0bb9ad4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +version 0.9.10 -- September 23, 2011 + backupninja changes + . Fix email reports, that were broken by the new locking support. + handler changes + dup: + . Cleanup: stop supporting duplicity < 0.6.01 (Redmine#2538). + . Fix incorrect duplicity version check for keepincroffulls. + Thanks to Olivier Berger <oberger@ouvaton.org> for the patch. + (Closes Redmine bug #3443) + (Closes: #641120) + ldap: + . Don't install LDAP handler, helper and example configuration file. + Don't mention LDAP support in documentation. + Official LDAP support will come back once this code has found + itself a maintainer. Interested? Get in touch! + rsync: + . Fixing $rsync_options output when rsync is local + (Closes Redmine bug #3001) + (Closes: #639545) + sh: + . Allow 'when = XXX' with spaces (Redmine#2769). + Thanks to aihtdikh for the patch. + sys: + . Remove useless and inconsistent executable bit on handler. + helper changes + rdiff: + . Fix infinite loop when version inconsistency is detected. + Thanks to Chris Lamb <lamby@debian.org> for the patch. + (Closes: #639547) version 0.9.9 -- May 15, 2011 backupninja changes . Use locking to avoid running concurrent instances of the same backup diff --git a/README b/README index 41d418681885caebd2f9d2fe28706fed8646e32b..8b138cf4436dffa40f9e79fd3fcb29ee7667d905 100644 --- a/README +++ b/README @@ -27,7 +27,6 @@ Backup types: incremental data is compressed. permissions are retained even with an unpriviledged backup user. - backup of mysql databases (via mysqlhotcopy and mysqldump). - - backup of ldap databases (via slapcat and ldapsearch). - basic system and hardware info - encrypted remote backups (via duplicity). - backup of subversion repositories. @@ -92,7 +91,6 @@ file in /etc/backup.d according to the file's suffix: .rdiff -- filesystem backup (using rdiff-backup) .dup -- filesystem backup (using duplicity) .mysql -- backup mysql databases - .ldap -- backup ldap databases .pgsql -- backup PostgreSQL databases .sys -- general hardware, partition, and system reports. .svn -- backup subversion repositories @@ -105,7 +103,7 @@ The configuration files are processed in alphabetical order. However, it is suggested that you name the config files in "sysvinit style." For example: - 00-disabled.ldap + 00-disabled.pgsql 10-runthisfirst.sh 20-runthisnext.mysql 90-runthislast.rdiff diff --git a/configure.in b/configure.in index bc43c9aa4b5a150f35c4416bc40ed052c4f3ef94..2d3068794c9f639fb9c867b2abe21647921d9ba5 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ # The maintainer mode is causing me grief with newest versions of autotools #AM_MAINTAINER_MODE -AC_INIT([backupninja],[0.9.9],[backupninja@lists.riseup.net]) +AC_INIT([backupninja],[0.9.10],[backupninja@lists.riseup.net]) AC_CONFIG_SRCDIR([src/backupninja.in]) AM_INIT_AUTOMAKE diff --git a/examples/Makefile.am b/examples/Makefile.am index ce92b0712faa62c157493c8d2502da542a4ce050..89bd56b22aa0244485a9a9d01bbfbdc6b0763896 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,5 +1,5 @@ -EXAMPLES = example.dup example.ldap example.maildir example.makecd example.mysql \ +EXAMPLES = example.dup example.maildir example.makecd example.mysql \ example.pgsql example.rdiff example.rsync example.sh \ example.svn example.sys example.trac diff --git a/examples/example.sh b/examples/example.sh index f02f02670c4a3d55e16697b42db0fe50f2bec21d..75b01622ff85c68b21a59468d8514e87a2eddaee 100644 --- a/examples/example.sh +++ b/examples/example.sh @@ -1,2 +1,4 @@ +# Note: the spaces around the equal sign ('=') are optional. +when = saturdays at 05:30 dpkg --get-selections > /var/backups/dpkg-selections.txt diff --git a/handlers/Makefile.am b/handlers/Makefile.am index c9ad2ba62caacdfd7225454e9052d1085b87e507..54155e89214f87e224216c2a8c1e7e48e4c1878a 100644 --- a/handlers/Makefile.am +++ b/handlers/Makefile.am @@ -1,5 +1,5 @@ -HANDLERS = dup dup.helper ldap ldap.helper maildir makecd \ +HANDLERS = dup dup.helper maildir makecd \ makecd.helper mysql mysql.helper pgsql pgsql.helper rdiff \ rdiff.helper rsync sh svn sys sys.helper trac tar tar.helper diff --git a/handlers/dup.in b/handlers/dup.in index b58d34d80908e3e0780501292d622c788da78fd0..40f67235d323a91c1c6e0be2093d37cfadb27170 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -155,9 +155,7 @@ else fi ### Cleanup options -if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -ge 1 ]; then - execstr_options="${execstr_options} --extra-clean" -fi +execstr_options="${execstr_options} --extra-clean" ### Temporary directory if [ -n "$tmpdir" ]; then @@ -172,12 +170,10 @@ if [ -n "$tmpdir" ]; then fi ### Archive directory -# duplicity >= 0.6.01 enables the archive_dir by default, let's put it into /var/cache/backupninja/duplicity +# duplicity now enables the archive_dir by default, let's put it into /var/cache/backupninja/duplicity # unless the user has specified it. -if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -ge 1 ]; then - if echo "${options}" | grep -qv -- "--archive-dir" ; then - execstr_options="${execstr_options} --archive-dir /var/cache/backupninja/duplicity" - fi +if echo "${options}" | grep -qv -- "--archive-dir" ; then + execstr_options="${execstr_options} --archive-dir /var/cache/backupninja/duplicity" fi ### Cleanup old backup sets (or not) @@ -279,7 +275,7 @@ fi # remove-all-inc-of-but-n-full : remove increments of older full backups : only keep latest ones if [ "$keep" != "yes" ]; then if [ "$keepincroffulls" != "all" ]; then - if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 9 -a "$duplicity_sub" -ge 10 ]; then + if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -ge 10 ]; then debug "$precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart" if [ ! $test ]; then export PASSPHRASE=$password diff --git a/handlers/rdiff.helper.in b/handlers/rdiff.helper.in index 039799e558c17355db861a39620e2c384fbc6476..1597305d700aea81f893d2d334d6fcfaf3c478de 100644 --- a/handlers/rdiff.helper.in +++ b/handlers/rdiff.helper.in @@ -265,7 +265,7 @@ do_rdiff_con() { fi fi else - msgBox "incompatible versions of rdiff-backup" "It looks like rdiff-backup is installed on the remote machine, but it may be an incompatible version with the one installed locally, or something else is amiss.\n\nPlease resolve this problem and then try connecting again.\n\n\nTry connecting again?" + booleanBox "incompatible versions of rdiff-backup" "It looks like rdiff-backup is installed on the remote machine, but it may be an incompatible version with the one installed locally, or something else is amiss.\n\nPlease resolve this problem and then try connecting again.\n\n\nTry connecting again?" if [ $? = 0 ]; then do_rdiff_con else diff --git a/handlers/rsync.in b/handlers/rsync.in index d93411a7cdd7255578529a96cf08aff629c2f435..6c772e111e9923c4fea08d127cd257e805fa96b6 100644 --- a/handlers/rsync.in +++ b/handlers/rsync.in @@ -893,7 +893,7 @@ function set_rsync_options { if [ "$from" == "local" ] || [ "$dest" == "local" ]; then # rsync options for local sources or destinations - rsync_options="$rsync_options" + rsync_options=($rsync_options) fi if [ "$from" == "remote" ] || [ "$dest" == "remote" ]; then @@ -1070,8 +1070,8 @@ for SECTION in $include; do set_dest info "Syncing $SECTION on $dest_path..." - debug $nice $rsync "${rsync_options[@]}" $filelist_flag $excludes $batch_option $orig $dest_path - $nice $rsync "${rsync_options[@]}" $filelist_flag $excludes $batch_option $orig $dest_path | tee -a $log + debug $nice $rsync $rsync_options $filelist_flag $excludes $batch_option $orig $dest_path + $nice $rsync $rsync_options $filelist_flag $excludes $batch_option $orig $dest_path | tee -a $log if [ "$?" != "0" ]; then warning "Rsync error when trying to transfer $SECTION" diff --git a/handlers/sh.in b/handlers/sh.in index b070f3bce24f962e47a404a341f84efc18e1d87c..384ca528b23271bb38a6b26e5ae676cef2d436ed 100644 --- a/handlers/sh.in +++ b/handlers/sh.in @@ -5,4 +5,11 @@ # runs the file /etc/backup.d/scriptname.sh # +# No-op function so that 'when = XXX' can be written as such in +# backup.d/*.sh, i.e. with spaces around the equal sign - as in every +# other backup.d/ file. +function when() { + true +} + [ $test ] || ( . $1 ) diff --git a/handlers/sys.in b/handlers/sys.in old mode 100755 new mode 100644 diff --git a/man/backup.d.5 b/man/backup.d.5 index fd5c9b2adca5335f97939afa875d09c3ffa63ffb..df2063e5bd82fa99ad4cb1f0ef75f9e78a12aec8 100644 --- a/man/backup.d.5 +++ b/man/backup.d.5 @@ -39,8 +39,6 @@ backup action for slow, incremental rsyncs of tens of thousands of maildirs. backup action for safe MySQL dumps. .IP .pgsql backup action for safe PostgreSQL dumps. -.IP .ldap -backup action for safe OpenLdap dumps. .IP .sys backup action for general system reports and hardware information. .IP .svn @@ -56,7 +54,7 @@ These files must be owned by root and must not be world or group readable/writab The configuration files are processed in alphabetical order. However, it is suggested that you name the config files in "sysvinit style." .TP For example: - 10-local.ldap.disabled + 10-local.pgsql.disabled 15-runthisfirst.sh 20-runthisnext.mysql 90-runthislast.rdiff @@ -67,7 +65,7 @@ Example templates for the action configuration files can be found in /usr/share/ .SH SCHEDULING -By default, each configuration file is processed everyday at 01:00 (1 AM). This can be changed by specifying the 'when' option in a backup action's config file or in the global configuration file. Special value 'manual' will disable scheduling for the backup action. It is possible to run the backup action manually by invoking \fBninjahelper(1)\fP with --run command line argument. +By default, each configuration file is processed everyday at 01:00 (1 AM). This can be changed by specifying the 'when' option in a backup action's config file or in the global configuration file. Special value 'manual' will disable scheduling for the backup action. It is possible to run the backup action manually by invoking \fBninjahelper(1)\fP with \-\-run command line argument. For example: when = sundays at 02:00 diff --git a/man/backupninja.1 b/man/backupninja.1 index 4363222c1441961a95a183fca3e9a66dd0ce1a68..b1d28758d5f9c404fa3b68a95e76826609cbf2ba 100644 --- a/man/backupninja.1 +++ b/man/backupninja.1 @@ -104,9 +104,9 @@ Then, vital parts of the file system, including /var/backups, are nightly pushed .TP In order for this to work (ie for diff-backup to run unattended), you must create ssh keys on the source server and copy the public key to the remote user's authorized keys file. For example: .br -root@srchost# ssh-keygen -t rsa -b 4096 +root@srchost# ssh-keygen \-t rsa \-b 4096 .br -root@srchost# ssh-copy-id -i /root/.ssh/id_dsa.pub backup@desthost +root@srchost# ssh-copy-id \-i /root/.ssh/id_dsa.pub backup@desthost .TP Now, you should be able to ssh from user 'root' on srchost to user 'backup' on desthost without specifying a password. When prompted for a password by ssh-keygen, just leave it blank by hitting return. The "wizard" \fBninjahelper(1)\fP will walk you through these steps. diff --git a/man/backupninja.conf.5 b/man/backupninja.conf.5 index 7911fdff9b1732e332a9b4281ff47bc99b0e2516..50e0238f81910bb08aa97c8eb75a28349a160c51 100644 --- a/man/backupninja.conf.5 +++ b/man/backupninja.conf.5 @@ -24,7 +24,7 @@ BACKUPNINJA.CONF \- Configuration file(s) for \fBbackupninja (1)\fP. .br .SH DESCRIPTION .B backupninja.conf -is the general configuration file. In this file you can set the log level and change the default directory locations. You can force a different general configuration file with "backupninja -f /path/to/conf". +is the general configuration file. In this file you can set the log level and change the default directory locations. You can force a different general configuration file with "backupninja \-f /path/to/conf". .SH OPTIONS diff --git a/man/ninjahelper.1 b/man/ninjahelper.1 index 34b1ce4baca292b283da1208eff70663fd7fffce..0135f693fa73145d3125d7cbfb7a5fc14306d588 100644 --- a/man/ninjahelper.1 +++ b/man/ninjahelper.1 @@ -33,7 +33,7 @@ menu-driven interface. To add an additional 'wizard' to ninjahelper, follow these steps: .IP (1) create a file in the handlers directory (eg. /usr/share/backupninja) using -the .helper extention. For example, if you wish to create a helper for the +the .helper extension. For example, if you wish to create a helper for the handler "blue", create the file /usr/share/backupninja/blue.helper. .IP (2) next, add your helper to the global HELPERS variable and define the main diff --git a/src/backupninja.in b/src/backupninja.in index f6a5b0e9faf61372703dd2e260d8640cd97abc2d..040082844ee0dbbc17888c1d23496af8d130a11f 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -325,7 +325,7 @@ function process_action() { # start locked section : avoid concurrent execution of the same backup # uses a construct specific to shell scripts with flock. See man flock for details - ( + { debug "executing handler in locked section controlled by $lockfile" flock -x -w 5 200 # if all is good, we acquired the lock @@ -352,7 +352,7 @@ function process_action() { debug "failed to acquire lock" echo "Fatal: Could not acquire lock $lockfile. A backup is probably already running for $file." >>$bufferfile fi - ) 200> $lockfile + } 200> $lockfile # end of locked section _warnings=`cat $bufferfile | grep "^Warning: " | wc -l`