mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-27 14:46:06 +08:00
dev
This commit is contained in:
parent
a371bf4e90
commit
103456dfca
|
@ -50,16 +50,22 @@ original_name=(
|
||||||
## 导入配置文件不校验
|
## 导入配置文件不校验
|
||||||
import_config_no_check () {
|
import_config_no_check () {
|
||||||
[ -f $file_cookie ] && . $file_cookie
|
[ -f $file_cookie ] && . $file_cookie
|
||||||
[ -f $file_sharecode ] && . $file_sharecode
|
|
||||||
[ -f $file_config_user ] && . $file_config_user
|
[ -f $file_config_user ] && . $file_config_user
|
||||||
}
|
}
|
||||||
|
|
||||||
## 导入配置文件并校验,$1:任务名称
|
## 导入配置文件并校验,$1:任务名称
|
||||||
import_config_and_check () {
|
import_config_and_check () {
|
||||||
import_config_no_check $1
|
import_config_no_check $1
|
||||||
if [[ -z ${Cookie1} ]]; then
|
if [[ ! -s $file_cookie ]]; then
|
||||||
echo -e "请先在配置好Cookie...\n"
|
echo -e "请先配置好Cookie...\n"
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
user_sum=0
|
||||||
|
for line in $(cat $file_cookie); do
|
||||||
|
let user_sum++
|
||||||
|
[[ $user_sum -gt $((3 * 5)) ]] && break
|
||||||
|
eval Cookie${user_sum}="\"$line\""
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,16 +78,6 @@ notify () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## 统计用户数量
|
|
||||||
count_user_sum () {
|
|
||||||
user_sum=0
|
|
||||||
for line in $(cat $file_cookie); do
|
|
||||||
let user_sum++
|
|
||||||
[[ $user_sum -gt $((3 * 5)) ]] && break
|
|
||||||
eval Cookie${user_sum}="\"$line\""
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
## 创建目录,$1:目录的绝对路径
|
## 创建目录,$1:目录的绝对路径
|
||||||
make_dir () {
|
make_dir () {
|
||||||
local dir=$1
|
local dir=$1
|
||||||
|
|
|
@ -46,11 +46,6 @@ combine_one () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
## 申明全部变量,$1:all/Cookie编号
|
|
||||||
export_all_env () {
|
|
||||||
[[ $type == all ]] && combine_all || combine_one $type
|
|
||||||
}
|
|
||||||
|
|
||||||
## 选择python3还是node
|
## 选择python3还是node
|
||||||
define_program () {
|
define_program () {
|
||||||
[[ $p1 == *.js ]] && which_program="node"
|
[[ $p1 == *.js ]] && which_program="node"
|
||||||
|
@ -116,9 +111,8 @@ run_normal () {
|
||||||
if [ -f $p1 ]; then
|
if [ -f $p1 ]; then
|
||||||
import_config_and_check "$p1"
|
import_config_and_check "$p1"
|
||||||
update_crontab
|
update_crontab
|
||||||
count_user_sum
|
|
||||||
define_program
|
define_program
|
||||||
export_all_env all
|
combine_all
|
||||||
[[ $# -eq 1 ]] && random_delay
|
[[ $# -eq 1 ]] && random_delay
|
||||||
log_time=$(date "+%Y-%m-%d-%H-%M-%S")
|
log_time=$(date "+%Y-%m-%d-%H-%M-%S")
|
||||||
log_path="$dir_log/$p1/$log_time.log"
|
log_path="$dir_log/$p1/$log_time.log"
|
||||||
|
@ -138,7 +132,6 @@ run_concurrent () {
|
||||||
if [ -f $p1 ]; then
|
if [ -f $p1 ]; then
|
||||||
import_config_and_check "$p1"
|
import_config_and_check "$p1"
|
||||||
update_crontab
|
update_crontab
|
||||||
count_user_sum
|
|
||||||
define_program
|
define_program
|
||||||
make_dir $dir_log/$p1
|
make_dir $dir_log/$p1
|
||||||
log_time=$(date "+%Y-%m-%d-%H-%M-%S.%N")
|
log_time=$(date "+%Y-%m-%d-%H-%M-%S.%N")
|
||||||
|
@ -147,7 +140,7 @@ run_concurrent () {
|
||||||
for num in ${TempBlockCookie}; do
|
for num in ${TempBlockCookie}; do
|
||||||
[[ $user_num -eq $num ]] && continue 2
|
[[ $user_num -eq $num ]] && continue 2
|
||||||
done
|
done
|
||||||
export_all_env $user_num
|
combine_one $user_num
|
||||||
log_path="$dir_log/$p1/${log_time}_${user_num}.log"
|
log_path="$dir_log/$p1/${log_time}_${user_num}.log"
|
||||||
$which_program $p1 &>$log_path &
|
$which_program $p1 &>$log_path &
|
||||||
done
|
done
|
||||||
|
|
|
@ -263,6 +263,10 @@ update_own_repo () {
|
||||||
echo -e "\n更新${array_own_repo_path[i]}失败,请检查原因...\n"
|
echo -e "\n更新${array_own_repo_path[i]}失败,请检查原因...\n"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
for ((i=0; i<${#array_own_scripts_path[*]}; i++)); do
|
||||||
|
diff_and_copy "$dir_sample/sendNotify.js" "${array_own_scripts_path[i]}/sendNotify.js"
|
||||||
|
diff_and_copy "$dir_sample/jdCookie.js" "${array_own_scripts_path[i]}/jdCookie.js"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
## 更新所有 raw 文件
|
## 更新所有 raw 文件
|
||||||
|
@ -283,6 +287,8 @@ update_own_raw () {
|
||||||
[ -f "$dir_raw/${raw_file_name[$i]}.new" ] && rm -f "$dir_raw/${raw_file_name[$i]}.new"
|
[ -f "$dir_raw/${raw_file_name[$i]}.new" ] && rm -f "$dir_raw/${raw_file_name[$i]}.new"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
diff_and_copy "$dir_sample/sendNotify.js" "$dir_raw/sendNotify.js"
|
||||||
|
diff_and_copy "$dir_sample/jdCookie.js" "$dir_raw/jdCookie.js"
|
||||||
}
|
}
|
||||||
|
|
||||||
## 调用用户自定义的extra.sh
|
## 调用用户自定义的extra.sh
|
||||||
|
|
Loading…
Reference in New Issue
Block a user