使用 rclone 工具备份文件到 minio 和 189 云盘
# 设置备份的服务
rclone config
# 列出所有服务
rclone show
# 备份
rclone copy sourcefile {service}:{bucket}
# 删除
rclone delete {service}:{bucket}/sourcefile
#!/usr/bin/env bash
##
# Backup with Rclone
##
set -e
backup() {
echo "backpu file: ${1}"
rclone copy "${1}" "${2}"
}
backup_dir="/data/backup"
backup_list=(
"qcloud:backup-1251136007/websites"
"minio:backup/websites"
"189:189/backup/websites"
)
pushd "${backup_dir}" >/dev/null 2>&1 || exit 1
for L in ${backup_list[@]}; do
IFS=':' read -r -a bucket <<< "$L"
while IFS= read -r _V; do
echo "$(date '+%Y-%m-%d %H:%M:%S') - Starting backup of ${_V} to ${L}" | tee -a "${backup_dir}/backup.log"
tee -a "${backup_dir}/backup.log" < <(backup "$_V" "${bucket[0]}:${bucket[1]}" 2>&1)
done < <(ls -t *.tgz | sort -r | uniq -w 8)
done
popd >/dev/null 2>&1 || exit 1