Skip to content

Commit

Permalink
backup_config script now handles missing files properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksim Zinal committed Apr 6, 2024
1 parent d7d1eda commit 6ac8289
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions roles/ydbd_config/templates/backup_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ fi

set -e

if [ -f ${YDB_DIR}/certs/ca.crt ]; then
mkdir -pv ${BACKUP_DIR}
chmod 700 ${BACKUP_DIR}
cp -v ${YDB_DIR}/certs/ca.crt ${BACKUP_DIR}/
cp -v ${YDB_DIR}/certs/node.crt ${BACKUP_DIR}/
cp -v ${YDB_DIR}/certs/node.key ${BACKUP_DIR}/
cp -v ${YDB_DIR}/certs/web.pem ${BACKUP_DIR}/
cp -v ${YDB_DIR}/certs/web.pem ${BACKUP_DIR}/
cp -v ${YDB_DIR}/cfg/ydbd-config.yaml ${BACKUP_DIR}/
cp -v ${YDB_DIR}/cfg/ydbd-static.yaml ${BACKUP_DIR}/
cp -v ${YDB_DIR}/cfg/ydbd-dynamic.yaml ${BACKUP_DIR}/
fi
preserve() {
if [ -f "$1" ]; then
cp -v "$1" ${BACKUP_DIR}/
fi
}

mkdir -pv ${BACKUP_DIR}
chmod 700 ${BACKUP_DIR}
preserve ${YDB_DIR}/certs/ca.crt
preserve ${YDB_DIR}/certs/node.crt
preserve ${YDB_DIR}/certs/node.key
preserve ${YDB_DIR}/certs/web.pem
preserve ${YDB_DIR}/certs/web.pem
preserve ${YDB_DIR}/cfg/ydbd-config.yaml
preserve ${YDB_DIR}/cfg/ydbd-static.yaml
preserve ${YDB_DIR}/cfg/ydbd-dynamic.yaml

# End Of File

0 comments on commit 6ac8289

Please sign in to comment.