From 4336f6f1759f95bd2d7d1df7051a13d26b796a6a Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Tue, 15 Jun 2021 23:15:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DTempCk=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8Dql=20raw=E6=8B=89=E5=8F=96=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/share.sh | 5 +++++ shell/task.sh | 7 +++++-- shell/update.sh | 9 +++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/shell/share.sh b/shell/share.sh index e4d9e0f2..28ca2c55 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -289,8 +289,13 @@ git_pull_scripts() { cd $dir_current } +init_env() { + TempBlockCookie="" +} + ## 导入配置文件,检测平台,创建软连接,识别命令,修复配置文件 detect_termux detect_macos define_cmd +init_env import_config $1 diff --git a/shell/task.sh b/shell/task.sh index 9ea31d87..0c181557 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -24,7 +24,10 @@ combine_sub() { ## 正常依次运行时,组合所有账号的Cookie与互助码 combine_all() { for ((i = 0; i < ${#env_name[*]}; i++)); do - export ${env_name[i]}=$(combine_sub ${var_name[i]}) + result=$(combine_sub ${var_name[i]}) + if [[ $result ]]; then + export ${env_name[i]}="$result" + fi done } @@ -53,7 +56,7 @@ random_delay() { local random_delay_max=$RandomDelay if [[ $random_delay_max ]] && [[ $random_delay_max -gt 0 ]]; then local current_min=$(date "+%-M") - if [[ $current_min -gt 2 && $current_min -lt 30 ]] || [[ $current_min -gt 31 && $current_min -lt 59 ]]; then + if [[ $current_min -ne 0 ]] && [[ $current_min -ne 30 ]]; then delay_second=$(($(gen_random_num $random_delay_max) + 1)) echo -e "\n命令未添加 \"now\",随机延迟 $delay_second 秒后再执行任务,如需立即终止,请按 CTRL+C...\n" sleep $delay_second diff --git a/shell/update.sh b/shell/update.sh index f8d8c5cb..bdc31cbc 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -89,7 +89,7 @@ del_cron() { local ids="" echo -e "开始尝试自动删除失效的定时任务...\n" for cron in $(cat $list_drop); do - local id=$(cat $list_crontab_user | grep -E "$cmd_task $cron$" | perl -pe "s|.*ID=(.*) $cmd_task $cron$|\1|" | xargs | sed 's/ /","/g') + local id=$(cat $list_crontab_user | grep -E "$cmd_task $cron" | perl -pe "s|.*ID=(.*) $cmd_task $cron|\1|" | xargs | sed 's/ /","/g' | head -1) if [[ $ids ]]; then ids="$ids,\"$id\"" else @@ -195,7 +195,7 @@ update_raw() { echo -e "下载 ${raw_file_name} 成功...\n" cd $dir_raw local filename="raw_${raw_file_name}" - local cron_id=$(cat $list_crontab_user | grep -E "$cmd_task $filename$" | perl -pe "s|.*ID=(.*) $cmd_task $filename$|\1|") + local cron_id=$(cat $list_crontab_user | grep -E "$cmd_task $filename" | perl -pe "s|.*ID=(.*) $cmd_task $filename\.*|\1|" | head -1) cp -f $raw_file_name $dir_scripts/${filename} cron_line=$( perl -ne "{ @@ -253,7 +253,8 @@ usage() { update_qinglong() { echo -e "--------------------------------------------------------------\n" [ -f $dir_root/package.json ] && ql_depend_old=$(cat $dir_root/package.json) - reset_romote_url ${dir_root} "${github_proxy_url}https://github.com/whyour/qinglong.git" + url=https://github.com/whyour/qinglong.git + reset_romote_url ${dir_root} "${github_proxy_url}${url/https:\/\/ghproxy.com\//}" git_pull_scripts $dir_root if [[ $exit_status -eq 0 ]]; then @@ -380,7 +381,7 @@ gen_list_repo() { filename=$(basename $file) cp -f $file $dir_scripts/${repo}_${filename} echo ${repo}_${filename} >>"$dir_list_tmp/${repo}_scripts.list" - cron_id=$(cat $list_crontab_user | grep -E "$cmd_task ${author}_${filename}" | perl -pe "s|.*ID=(.*) $cmd_task ${author}_${filename}\.*|\1|") + cron_id=$(cat $list_crontab_user | grep -E "$cmd_task ${author}_${filename}" | perl -pe "s|.*ID=(.*) $cmd_task ${author}_${filename}\.*|\1|" | head -1) if [[ $cron_id ]]; then result=$(update_cron_command_api "$cmd_task ${repo}_${filename}:$cron_id") fi