将阿里云盘执行路径换成绝对路径

This commit is contained in:
lsy 2024-07-26 19:26:45 +08:00
parent 90aa5271a6
commit bbf2eaa789

View File

@ -63,6 +63,7 @@ if [[ ! $aliyun_pick =~ [Nn] ]];then
./aliyunpan login ./aliyunpan login
else else
echo "检测到阿里云盘已经存在,请确认是否登录" echo "检测到阿里云盘已经存在,请确认是否登录"
cd aliyunpan
./aliyunpan who ./aliyunpan who
fi fi
fi fi
@ -71,7 +72,6 @@ cat > "${path}/backup.sh" << EOF
#!/bin/bash #!/bin/bash
declare date_time=$(date +"%Y_%m_%d") # 日期格式 declare date_time=$(date +"%Y_%m_%d") # 日期格式
declare year=$(date +"%Y") #年份 declare year=$(date +"%Y") #年份
cd "${path}/aliyunpan"
source "${path}/venv/bin/activate" source "${path}/venv/bin/activate"
for item in "$web_path"/*; do for item in "$web_path"/*; do
@ -79,7 +79,7 @@ for item in "$web_path"/*; do
cd "\$item" || exit cd "\$item" || exit
tar -czf "\${item_name}_\${date_time}.tar.gz" . tar -czf "\${item_name}_\${date_time}.tar.gz" .
bypy upload "\${item_name}_\${date_time}.tar.gz" "/\${item_name}/" bypy upload "\${item_name}_\${date_time}.tar.gz" "/\${item_name}/"
./aliyunpan upload "\${item_name}_\${date_time}.tar.gz" "/网站/\${item_name}/\${year}/" ${path}/aliyunpan/aliyunpan upload "\${item_name}_\${date_time}.tar.gz" "/网站/\${item_name}/\${year}/"
cp "\${item_name}_\${date_time}.tar.gz" "${web_path}/\${year}/" cp "\${item_name}_\${date_time}.tar.gz" "${web_path}/\${year}/"
rm "\${item_name}_\${date_time}.tar.gz" rm "\${item_name}_\${date_time}.tar.gz"
done done