From ccd83b9200c4a69c955bc9f5b9b62631ccb1fc58 Mon Sep 17 00:00:00 2001 From: lsy Date: Sun, 21 Jul 2024 14:00:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0ssh=E8=84=9A=E6=9C=AC,?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=87=E4=BB=BD=E8=84=9A=E6=9C=AC,?= =?UTF-8?q?=E5=88=A0=E9=99=A4nginx=E8=AF=81=E4=B9=A6=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/code/backups/backups_file_mysql_cloud_docker.sh | 6 ++---- shell/code/ng_ln.sh | 6 ------ shell/code/ssh.sh | 10 +++++----- 3 files changed, 7 insertions(+), 15 deletions(-) delete mode 100644 shell/code/ng_ln.sh diff --git a/shell/code/backups/backups_file_mysql_cloud_docker.sh b/shell/code/backups/backups_file_mysql_cloud_docker.sh index 1a0c9f6..20e0b7c 100644 --- a/shell/code/backups/backups_file_mysql_cloud_docker.sh +++ b/shell/code/backups/backups_file_mysql_cloud_docker.sh @@ -13,14 +13,12 @@ for item in "$web_path"/*; do # 切换到网站目录进行压缩 cd "$item" || exit 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}/" # 上传到阿里云盘 aliyunpan upload "${item_name}_${date_time}.zip" "/网站/${item_name}/${year}/" # 删除文件 rm "${item_name}_${date_time}.zip" + # 返回原始目录 + cd "$original_dir" || exit done \ No newline at end of file diff --git a/shell/code/ng_ln.sh b/shell/code/ng_ln.sh deleted file mode 100644 index cbda5b5..0000000 --- a/shell/code/ng_ln.sh +++ /dev/null @@ -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 diff --git a/shell/code/ssh.sh b/shell/code/ssh.sh index 08f00b8..199fde1 100644 --- a/shell/code/ssh.sh +++ b/shell/code/ssh.sh @@ -45,7 +45,7 @@ install_key(){ fi - systemctl restart sshd.service + sudo systemctl restart sshd.service echo "密钥安装完成" } @@ -132,10 +132,10 @@ alter_port() { echo "端口已经修改为$port_number,记得防火墙放行" } -if [ "$(id -u)" != "0" ]; then - echo "该脚本必须以root权限运行" 1>&2 - exit 1 -fi +if not command -v sudo &> /dev/null +then + echo "sudo 未安装" +fi while true do