From 3956206c45bac8445b3c626f04c95a8caa7b6f0e Mon Sep 17 00:00:00 2001 From: gitea Date: Thu, 8 Jun 2023 10:02:29 +0800 Subject: [PATCH] [modify] rewrite backups.sh, add dash logo change, and change the start program of calibre --- update/backups.sh | 2 +- update/calibre.sh | 5 +++-- update/dash_rand_logo.sh | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/update/backups.sh b/update/backups.sh index 5f76922..36ad234 100644 --- a/update/backups.sh +++ b/update/backups.sh @@ -14,7 +14,7 @@ cp -rf /etc/apt/sources.list /opt/configs/conf/ cp -rf /root/.acme.sh/*ecc /opt/configs/acme/ cd /opt && t=`date +%Y%m%dT%H%M%S` -rsync -av apps configs logs scripts websites wd/72-Backups/CrossChain/VPS/ > /opt/logs/rsync/rsync_${t}.log +rsync -av --delete apps configs logs scripts websites wd/72-Backups/CrossChain/VPS/ > /opt/logs/rsync/rsync_${t}.log cd /opt/logs/rsync/ let count=`ls | wc -l` if [[ $count -gt 10 ]]; then diff --git a/update/calibre.sh b/update/calibre.sh index 18bd3e7..b78efbb 100644 --- a/update/calibre.sh +++ b/update/calibre.sh @@ -1,7 +1,8 @@ #!/bin/bash +calibre='/opt/apps/calibre/calibre-web-0.6.20' # get the pid of calibre, and write it into file /tmp/calibre_pids -ps -ef | grep '/opt/apps/calibre/venv/bin/cps' | grep -v grep | awk '{print $2}' > /tmp/calibre_pids +ps -ef | grep "$calibre/cps.py" | grep -v grep | awk '{print $2}' > /tmp/calibre_pids # if not exist, signifying that there is no calibre process if [[ ! -s /tmp/calibre_pids ]]; then @@ -12,6 +13,6 @@ else done fi -nohup /opt/apps/calibre/venv/bin/python /opt/apps/calibre/venv/bin/cps > /dev/null 2>&1 & +nohup $calibre/venv/bin/python $calibre/cps.py > /dev/null 2>&1 & echo -e "\e[1;32mCalibre process started successfully\e[0m" diff --git a/update/dash_rand_logo.sh b/update/dash_rand_logo.sh index 282fa31..566de39 100644 --- a/update/dash_rand_logo.sh +++ b/update/dash_rand_logo.sh @@ -2,7 +2,7 @@ # 设置图片数量和输出文件名 IMAGE_NUM_ALL=`ls /opt/apps/localcr/A_dashboard/local/icons | wc -l` -IMAGE_NUM_NEEDED=`cat /root/services.yaml | grep -E '[0-9]{1,3}.jpg' | wc -l` +IMAGE_NUM_NEEDED=`cat /opt/apps/localcr/A_dashboard/local/config/services.yaml | grep -E '[0-9]{1,3}.jpg' | wc -l` if [[ $IMAGE_NUM_NEEDED -gt $IMAGE_NUM_ALL ]]; then alarm='Dashboard:\nThere is NOT enough logos to use, please check ASAP.' bash /opt/scripts/alert/sendmsg.sh "$alarm" @@ -39,8 +39,6 @@ done # 需要修改的文件的路径和名称 filename_origin="/opt/apps/localcr/A_dashboard/local/config/services.yaml" filename_copy="/opt/apps/localcr/A_dashboard/local/config/services_copy.yaml" -# filename_origin="/root/services.yaml" -# filename_copy="/root/services_copy.yaml" cp $filename_origin $filename_copy # 循环处理所有符合指定模式的行 @@ -52,6 +50,7 @@ while read line; do if [[ $oldname != '' ]]; then newname=${arr[$count]} + # echo $newname = $oldname # 替换文件名 sed -i "${lineno}s/\/$oldname/\/$newname/" $filename_origin let count=count+1