代码拉取完成,页面将自动刷新
#!/bin/zsh
# A script to perform incremental backups using rsync
set -o errexit
set -o nounset
set -o pipefail
BACKUP_ROOT="/source/backup"
DATETIME="$(date '+%Y-%m-%d_%H:%M:%S')"
# BACKUP latex_data-sharelatex_data
SOURCE_DIR="/home/fnlp/latex_data/sharelatex_data"
BACKUP_DIR="${BACKUP_ROOT}/latex_data/sharelatex_data"
mkdir -p "${BACKUP_DIR}"
BACKUP_PATH="${BACKUP_DIR}/${DATETIME}"
LATEST_LINK="${BACKUP_DIR}/latest"
rsync -av --delete \
"${SOURCE_DIR}/" \
--link-dest "${LATEST_LINK}" \
--exclude=".cache" \
"${BACKUP_PATH}"
rm -rf "${LATEST_LINK}"
ln -s "${BACKUP_PATH}" "${LATEST_LINK}"
# BACKUP latex_data-mongodb
docker exec latex_mongo /bin/bash -c "mongodump -o /data/db/backup"
SOURCE_DIR="/home/fnlp/latex_data/mongo_data/backup"
BACKUP_DIR="${BACKUP_ROOT}/latex_data/mongodb"
mkdir -p "${BACKUP_DIR}"
BACKUP_PATH="${BACKUP_DIR}/${DATETIME}"
LATEST_LINK="${BACKUP_DIR}/latest"
rsync -av --delete \
"${SOURCE_DIR}/" \
--link-dest "${LATEST_LINK}" \
--exclude=".cache" \
"${BACKUP_PATH}"
rm -rf "${LATEST_LINK}"
ln -s "${BACKUP_PATH}" "${LATEST_LINK}"
# BACKUP mongo4
docker exec mongo4 /bin/bash -c "mongodump -o /data/db/backup --username ${DB_USER} --password ${DB_PASSWORD}"
SOURCE_DIR="/home/fnlp/mongo4/backup"
BACKUP_DIR="${BACKUP_ROOT}/mongo4"
mkdir -p "${BACKUP_DIR}"
BACKUP_PATH="${BACKUP_DIR}/${DATETIME}"
LATEST_LINK="${BACKUP_DIR}/latest"
rsync -av --delete \
"${SOURCE_DIR}/" \
--link-dest "${LATEST_LINK}" \
--exclude=".cache" \
"${BACKUP_PATH}"
rm -rf "${LATEST_LINK}"
ln -s "${BACKUP_PATH}" "${LATEST_LINK}"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。