25 lines
543 B
Django/Jinja
Executable File
25 lines
543 B
Django/Jinja
Executable File
#!/bin/bash
|
|
|
|
# Backup the Ceph monitor data
|
|
# {{ ansible_managed }}
|
|
|
|
set -o errexit
|
|
|
|
BACKUP_DIR="/srv/backups"
|
|
DATE="$( date +%Y%m%d )"
|
|
HOSTNAME="$( hostname -s )"
|
|
|
|
if [[ ! -d ${BACKUP_DIR} ]]; then
|
|
mkdir -p ${BACKUP_DIR}
|
|
fi
|
|
|
|
pushd ${BACKUP_DIR} &>/dev/null
|
|
|
|
MON_BACKUP_FILENAME_BASE="ceph-mon-backup"
|
|
MON_BACKUP_FILENAME="${BACKUP_DIR}/${MON_BACKUP_FILENAME_BASE}.${DATE}.tar.xz"
|
|
|
|
tar -cJf ${MON_BACKUP_FILENAME} /var/lib/ceph/mon
|
|
find ${BACKUP_DIR} -type f -name "${MON_BACKUP_FILENAME_BASE}*" -mtime +7 -exec rm {} \;
|
|
|
|
popd &>/dev/null
|