mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-27 22:56:07 +08:00
dev
This commit is contained in:
parent
103456dfca
commit
89521e7538
|
@ -66,18 +66,19 @@ random_delay () {
|
||||||
|
|
||||||
## scripts目录下所有可运行脚本数组
|
## scripts目录下所有可运行脚本数组
|
||||||
gen_array_scripts () {
|
gen_array_scripts () {
|
||||||
|
import_config_no_check
|
||||||
count_own_repo_sum
|
count_own_repo_sum
|
||||||
gen_own_dir_and_path
|
gen_own_dir_and_path
|
||||||
local dir_current=$(pwd)
|
local dir_current=$(pwd)
|
||||||
local i=0
|
local i="-1"
|
||||||
for ((scripts_path_num=0; scripts_path_num<${#array_own_scripts_path[*]}; scripts_path_num++)); do
|
for ((scripts_path_num=0; scripts_path_num<${#array_own_scripts_path[*]}; scripts_path_num++)); do
|
||||||
cd ${array_own_scripts_path[$scripts_path_num]}
|
cd ${array_own_scripts_path[$scripts_path_num]}
|
||||||
for file in $(ls); do
|
for file in $(ls); do
|
||||||
if [ -f $file ] && [[ $(grep "new Env" $file) ]] && [[ $file == *.js && $file != sendNotify.js && $file != JD_extra_cookie.js ]]; then
|
if [ -f $file ] && [[ $(grep "new Env" $file) ]] && [[ $file == *.js && $file != sendNotify.js && $file != JD_extra_cookie.js ]]; then
|
||||||
array_scripts[i]="${array_own_scripts_path[$scripts_path_num]}/$file"
|
let i++
|
||||||
|
array_scripts[i]=$(echo "${array_own_scripts_path[$scripts_path_num]}/$file" | perl -pe "s|$dir_scripts/||g")
|
||||||
array_scripts_name[i]=$(grep "new Env" $file | awk -F "'|\"" '{print $2}' | head -1)
|
array_scripts_name[i]=$(grep "new Env" $file | awk -F "'|\"" '{print $2}' | head -1)
|
||||||
[[ -z ${array_scripts_name[i]} ]] && array_scripts_name[i]="<未识别出活动名称>"
|
[[ -z ${array_scripts_name[i]} ]] && array_scripts_name[i]="<未识别出活动名称>"
|
||||||
let i++
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
@ -87,12 +88,13 @@ gen_array_scripts () {
|
||||||
## 使用说明
|
## 使用说明
|
||||||
usage () {
|
usage () {
|
||||||
define_cmd
|
define_cmd
|
||||||
echo -e "\ntask命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或相对路径(定时任务中建议写作去掉 $dir_scripts 目录后的相对路径),用法为:"
|
gen_array_scripts
|
||||||
|
echo -e "\ntask命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或相对路径(定时任务中建议写作去掉 $dir_scripts/ 目录后的相对路径),用法为:"
|
||||||
echo -e "1.$cmd_task <js_path> # 依次执行,如果设置了随机延迟并且当时时间不在0-2、30-31、59分内,将随机延迟一定秒数"
|
echo -e "1.$cmd_task <js_path> # 依次执行,如果设置了随机延迟并且当时时间不在0-2、30-31、59分内,将随机延迟一定秒数"
|
||||||
echo -e "2.$cmd_task <js_path> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
|
echo -e "2.$cmd_task <js_path> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
|
||||||
echo -e "3.$cmd_task <js_path> conc # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
|
echo -e "3.$cmd_task <js_path> conc # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
|
||||||
echo -e "\nmytask命令运行未识别出cron的脚本以及你自己添加的脚本,用法同task。mytask和task命令均为同一脚本的不同名字,二者仅用来在crontab.list中区分不同类型的任务,以方便自动增删任务,手动直接运行task即可。"
|
echo -e "\nmytask命令运行未识别出cron的脚本以及你自己添加的脚本,用法同task。mytask和task命令均为同一脚本的不同名字,二者仅用来在crontab.list中区分不同类型的任务,以方便自动增删任务,手动直接运行task即可。"
|
||||||
echo -e "\n当前有以下脚本可以运行:"
|
echo -e "\n当前有以下脚本可以运行(已省略路径 $dir_scripts/ ):"
|
||||||
for ((i=0; i<${#array_scripts[*]}; i++)); do
|
for ((i=0; i<${#array_scripts[*]}; i++)); do
|
||||||
echo -e "$(($i + 1)). ${array_scripts_name[i]}:${array_scripts[i]}"
|
echo -e "$(($i + 1)). ${array_scripts_name[i]}:${array_scripts[i]}"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user