From 894b8e3a469f41e2792075d7b063c0cd5e853e04 Mon Sep 17 00:00:00 2001 From: lsy Date: Tue, 18 Jun 2024 00:48:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A4=87=E4=BB=BD=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E8=AF=A6=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{backups.sh => backups/backups_file_mysql.sh} | 0 .../backups_file_mysql_cloud.sh} | 15 +++++++++++++-- .../backups_file_mysql_cloud_docker.sh} | 9 +++++---- 3 files changed, 18 insertions(+), 6 deletions(-) rename shell/code/{backups.sh => backups/backups_file_mysql.sh} (100%) rename shell/code/{backups_baidupan.sh => backups/backups_file_mysql_cloud.sh} (79%) rename shell/code/{webbackups_docker.sh => backups/backups_file_mysql_cloud_docker.sh} (87%) diff --git a/shell/code/backups.sh b/shell/code/backups/backups_file_mysql.sh similarity index 100% rename from shell/code/backups.sh rename to shell/code/backups/backups_file_mysql.sh diff --git a/shell/code/backups_baidupan.sh b/shell/code/backups/backups_file_mysql_cloud.sh similarity index 79% rename from shell/code/backups_baidupan.sh rename to shell/code/backups/backups_file_mysql_cloud.sh index 2fd3aee..6fe4712 100644 --- a/shell/code/backups_baidupan.sh +++ b/shell/code/backups/backups_file_mysql_cloud.sh @@ -9,6 +9,9 @@ user="root" # 数据库用户名 password="lsy22.com" # 数据库密码 original_dir=$(pwd) # 记录原始目录 +# 激活百度网盘环境 +source ~/myvenv/bin/activate + # 组合备份 for item in "${mysql_arry[@]}"; do # 创建SQL备份 @@ -34,6 +37,11 @@ for item in "${mysql_arry[@]}"; do rm "${item}_${date_time}.sql" # 上传到云存储 bypy upload "${item}_${date_time}.zip" "/${item}/${year}/" + # 上传到百度网盘存储 + bypy upload "${item}_${date_time}.zip" "/${item}/" + # 上传到阿里云盘 + aliyunpan upload "${item}_${date_time}.zip" "/网站/${item}/${year}/" + # 删除文件 rm "${item}_${date_time}.zip" done @@ -47,8 +55,11 @@ for item in "${web_arry[@]}"; do mv "${item}_${date_time}_data.zip" "$original_dir" # 返回原始目录 cd "$original_dir" || exit - # 上传到云存储 - bypy upload "${item}_${date_time}_data.zip" "/${item}/${year}/" + # 上传到百度网盘存储 + bypy upload "${item}_${date_time}.zip" "/${item}/" + # 上传到阿里云盘 + aliyunpan upload "${item}_${date_time}.zip" "/网站/${item}/${year}/" + # 删除文件 rm "${item}_${date_time}_data.zip" fi done \ No newline at end of file diff --git a/shell/code/webbackups_docker.sh b/shell/code/backups/backups_file_mysql_cloud_docker.sh similarity index 87% rename from shell/code/webbackups_docker.sh rename to shell/code/backups/backups_file_mysql_cloud_docker.sh index 68dd29d..1a0c9f6 100644 --- a/shell/code/webbackups_docker.sh +++ b/shell/code/backups/backups_file_mysql_cloud_docker.sh @@ -5,6 +5,9 @@ date_time=$(date +"%Y_%m_%d") # 日期格式 year=$(date +"%Y") #年份 original_dir=$(pwd) # 记录原始目录 +# 激活百度网盘环境 +source ~/myvenv/bin/activate + for item in "$web_path"/*; do item_name=$(basename "$item") # 切换到网站目录进行压缩 @@ -14,12 +17,10 @@ for item in "$web_path"/*; do mv "${item_name}_${date_time}.zip" "$original_dir" # 返回原始目录 cd "$original_dir" || exit - # 激活百度网盘环境 - source ~/shell/myvenv/bin/activate - # 上传到云存储 + # 上传到百度网盘存储 bypy upload "${item_name}_${date_time}.zip" "/${item_name}/" # 上传到阿里云盘 aliyunpan upload "${item_name}_${date_time}.zip" "/网站/${item_name}/${year}/" # 删除文件 rm "${item_name}_${date_time}.zip" -done +done \ No newline at end of file