Ability to set number of backupninja backups to keep
Change-Id: I27c4c6995a3d40c6c6210c258f53773fc3d6fdaf
diff --git a/README.rst b/README.rst
index 9392502..a05787b 100644
--- a/README.rst
+++ b/README.rst
@@ -115,6 +115,21 @@
..note:: Parameter ``auto_backup_disabled`` is optional. It disables automatic
backup when set to true. It's set to ``false``by default when not defined.
+Backup client with defined number of backups to keep:
+
+..code-block:: yaml
+
+ backupninja:
+ client:
+ enabled: true
+ engine: rsync
+ host: 10.10.10.208
+ user: backupninja
+ keep: 4
+
+ ..note:: The ``keep`` parameter defines number of backups to keep. If not
+ defined it's set to ``7`` by default.
+
Backup server rsync/rdiff
.. code-block:: yaml
diff --git a/backupninja/files/rsync.conf b/backupninja/files/rsync.conf
index 266eb59..19b5c26 100644
--- a/backupninja/files/rsync.conf
+++ b/backupninja/files/rsync.conf
@@ -61,7 +61,7 @@
# that with the days config your backup gets a .0 suffix at the destination
# folder, making it easier to turn it later to an incremental backup.
#
-days = 7
+days = {{ client.target.keep|default(7) }}
# for long storage format, specify the number of daily backup increments
#keepdaily = 7
diff --git a/backupninja/files/rsync.sh b/backupninja/files/rsync.sh
index 354e451..c3d8241 100644
--- a/backupninja/files/rsync.sh
+++ b/backupninja/files/rsync.sh
@@ -259,7 +259,7 @@
fi
ssh_cmd_base="ssh -T -o PasswordAuthentication=no -p $port -i $id_file"
- ssh_cmd="$ssh_cmd_base $user@$host"
+ ssh_cmd="$ssh_cmd_base $user@$host bash"
if [ "$from" == "remote" ] || [ "$dest" == "remote" ]; then
if [ "$testconnect" == "yes" ] && [ "$protocol" == "ssh" ]; then