backuppc ipa-backup script
This commit is contained in:
parent
f83f04bb4e
commit
92a2bddb60
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
TYPE=$1
|
||||
RETENTION=$2
|
||||
# parameters passed by backuppc
|
||||
|
||||
BACKUP_DIR=/var/lib/ipa/backup
|
||||
|
||||
if [ $RETENTION = '' ]
|
||||
then
|
||||
RETENTION=2
|
||||
fi
|
||||
|
||||
cd $BACKUP_DIR
|
||||
|
||||
# delete older ipa backups by counting fulls into account
|
||||
OLDERFULL=`ls -1trd ipa-full-* | tail -$RETENTION | head -1`
|
||||
|
||||
TODELETE=`find . -maxdepth 1 -type d -name 'ipa-*' ! -newer $OLDERFULL | grep -v $OLDERFULL | tr '\n' ' '`
|
||||
|
||||
for i in $TODELETE
|
||||
do
|
||||
rm -rfv $i
|
||||
done
|
||||
|
||||
# execute full ipa backup with a full backuppc backup
|
||||
if [ $TYPE = 'full' ]
|
||||
then
|
||||
ipa-backup
|
||||
elif [ $TYPE = 'incr' ]
|
||||
then
|
||||
ipa-backup --data --online
|
||||
else
|
||||
echo "first parameter (type) must be full or incr"
|
||||
fi
|
||||
|
|
@ -79,3 +79,8 @@
|
|||
- ansible_distribution_file_variety == "RedHat"
|
||||
- ipa_run_the_installation_command | bool
|
||||
tags: [ 'ipa' ]
|
||||
|
||||
- name: backuppc root script for ipa-backup
|
||||
copy: src=freeipa-backup.sh dest=/usr/local/sbin/freeipa-backup.sh owner=root mode=0744
|
||||
tags: [ 'ipa_backup', 'ipa' ]
|
||||
|
||||
|
|
Loading…
Reference in New Issue