更新ssh脚本,优化备份脚本,删除nginx证书链接

This commit is contained in:
lsy 2024-07-21 14:00:12 +08:00
parent 9298d47d00
commit ccd83b9200
3 changed files with 7 additions and 15 deletions

View File

@ -13,14 +13,12 @@ for item in "$web_path"/*; do
# 切换到网站目录进行压缩 # 切换到网站目录进行压缩
cd "$item" || exit cd "$item" || exit
zip -r "${item_name}_${date_time}.zip" . zip -r "${item_name}_${date_time}.zip" .
# 移动压缩文件回原始目录
mv "${item_name}_${date_time}.zip" "$original_dir"
# 返回原始目录
cd "$original_dir" || exit
# 上传到百度网盘存储 # 上传到百度网盘存储
bypy upload "${item_name}_${date_time}.zip" "/${item_name}/" bypy upload "${item_name}_${date_time}.zip" "/${item_name}/"
# 上传到阿里云盘 # 上传到阿里云盘
aliyunpan upload "${item_name}_${date_time}.zip" "/网站/${item_name}/${year}/" aliyunpan upload "${item_name}_${date_time}.zip" "/网站/${item_name}/${year}/"
# 删除文件 # 删除文件
rm "${item_name}_${date_time}.zip" rm "${item_name}_${date_time}.zip"
# 返回原始目录
cd "$original_dir" || exit
done done

View File

@ -1,6 +0,0 @@
#!/bin/bash
for file in /etc/nginx/sites-available/*;do
base=$(basename "$file")
ln -s "$file" "/etc/nginx/sites-enabled"
done

View File

@ -45,7 +45,7 @@ install_key(){
fi fi
systemctl restart sshd.service sudo systemctl restart sshd.service
echo "密钥安装完成" echo "密钥安装完成"
} }
@ -132,9 +132,9 @@ alter_port() {
echo "端口已经修改为$port_number,记得防火墙放行" echo "端口已经修改为$port_number,记得防火墙放行"
} }
if [ "$(id -u)" != "0" ]; then if not command -v sudo &> /dev/null
echo "该脚本必须以root权限运行" 1>&2 then
exit 1 echo "sudo 未安装"
fi fi
while true while true