修复TempCk问题,修复ql raw拉取任务重复

This commit is contained in:
hanhh 2021-06-15 23:15:58 +08:00
parent 8c7f1bc3d3
commit 4336f6f175
3 changed files with 15 additions and 6 deletions

View File

@ -289,8 +289,13 @@ git_pull_scripts() {
cd $dir_current
}
init_env() {
TempBlockCookie=""
}
## 导入配置文件,检测平台,创建软连接,识别命令,修复配置文件
detect_termux
detect_macos
define_cmd
init_env
import_config $1

View File

@ -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

View File

@ -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