mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修复cron列表状态显示顺序
This commit is contained in:
parent
e7355842d9
commit
12896659a8
|
@ -17,9 +17,7 @@ CommandTimeoutTime="1h"
|
||||||
MaxConcurrentNum="5"
|
MaxConcurrentNum="5"
|
||||||
|
|
||||||
## 在运行 task 命令时,随机延迟启动任务的最大延迟时间
|
## 在运行 task 命令时,随机延迟启动任务的最大延迟时间
|
||||||
## 如果任务不是必须准点运行的任务,那么给它增加一个随机延迟,由你定义最大延迟时间,单位为秒,如 RandomDelay="300" ,表示任务将在 1-300 秒内随机延迟一个秒数,然后再运行
|
## 默认给javascript任务加随机延迟,如 RandomDelay="300" ,表示任务将在 1-300 秒内随机延迟一个秒数,然后再运行,取消延迟赋值为空
|
||||||
## 在crontab.list中,在每小时第0-2分、第30-31分、第59分这几个时间内启动的任务,均算作必须准点运行的任务,在启动这些任务时,即使你定义了RandomDelay,也将准点运行,不启用随机延迟
|
|
||||||
## 在crontab.list中,除掉每小时上述时间启动的任务外,其他任务在你定义了 RandomDelay 的情况下,一律启用随机延迟,但如果你给某些任务添加了 "now" 或者 "conc",那么这些任务也将无视随机延迟直接启动
|
|
||||||
RandomDelay="300"
|
RandomDelay="300"
|
||||||
|
|
||||||
## 如果你自己会写shell脚本,并且希望在每次运行 ql update 命令时,额外运行你的 shell 脚本,请赋值为 "true",默认为true
|
## 如果你自己会写shell脚本,并且希望在每次运行 ql update 命令时,额外运行你的 shell 脚本,请赋值为 "true",默认为true
|
||||||
|
|
|
@ -78,7 +78,7 @@ usage() {
|
||||||
define_cmd
|
define_cmd
|
||||||
gen_array_scripts
|
gen_array_scripts
|
||||||
echo -e "task命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或去掉 “$dir_scripts/” 目录后的相对路径(定时任务中请写作相对路径),用法为:"
|
echo -e "task命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或去掉 “$dir_scripts/” 目录后的相对路径(定时任务中请写作相对路径),用法为:"
|
||||||
echo -e "1.$cmd_task <file_name> # 依次执行,如果设置了随机延迟并且当时时间不在0-2、30-31、59分内,将随机延迟一定秒数"
|
echo -e "1.$cmd_task <file_name> # 依次执行,如果设置了随机延迟,将随机延迟一定秒数"
|
||||||
echo -e "2.$cmd_task <file_name> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
|
echo -e "2.$cmd_task <file_name> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
|
||||||
echo -e "3.$cmd_task <file_name> conc # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
|
echo -e "3.$cmd_task <file_name> conc # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
|
||||||
if [[ ${#array_scripts[*]} -gt 0 ]]; then
|
if [[ ${#array_scripts[*]} -gt 0 ]]; then
|
||||||
|
|
|
@ -245,15 +245,17 @@ usage() {
|
||||||
## 更新qinglong
|
## 更新qinglong
|
||||||
update_qinglong() {
|
update_qinglong() {
|
||||||
echo -e "--------------------------------------------------------------\n"
|
echo -e "--------------------------------------------------------------\n"
|
||||||
|
[ -f $dir_root/package.json ] && ql_depend_old=$(cat $dir_root/package.json)
|
||||||
git_pull_scripts $dir_root
|
git_pull_scripts $dir_root
|
||||||
|
|
||||||
if [[ $exit_status -eq 0 ]]; then
|
if [[ $exit_status -eq 0 ]]; then
|
||||||
echo -e "\n更新$dir_root成功...\n"
|
echo -e "\n更新$dir_root成功...\n"
|
||||||
npm_install_2 $dir_root
|
|
||||||
|
|
||||||
cp -f $file_config_sample $dir_config/config.sample.sh
|
cp -f $file_config_sample $dir_config/config.sample.sh
|
||||||
detect_config_version
|
detect_config_version
|
||||||
update_depend
|
update_depend
|
||||||
|
|
||||||
|
[ -f $dir_root/package.json ] && ql_depend_new=$(cat $dir_root/package.json)
|
||||||
|
[[ "$ql_depend_old" != "$ql_depend_new" ]] && npm_install_2 $dir_root
|
||||||
else
|
else
|
||||||
echo -e "\n更新$dir_root失败,请检查原因...\n"
|
echo -e "\n更新$dir_root失败,请检查原因...\n"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -103,7 +103,7 @@ const Crontab = () => {
|
||||||
align: 'center' as const,
|
align: 'center' as const,
|
||||||
render: (text: string, record: any) => (
|
render: (text: string, record: any) => (
|
||||||
<>
|
<>
|
||||||
{!record.isDisabled && (
|
{(!record.isDisabled || record.status !== CrontabStatus.idle) && (
|
||||||
<>
|
<>
|
||||||
{record.status === CrontabStatus.idle && (
|
{record.status === CrontabStatus.idle && (
|
||||||
<Tag icon={<ClockCircleOutlined />} color="default">
|
<Tag icon={<ClockCircleOutlined />} color="default">
|
||||||
|
@ -125,7 +125,7 @@ const Crontab = () => {
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{record.isDisabled === 1 && (
|
{record.isDisabled === 1 && record.status === CrontabStatus.idle && (
|
||||||
<Tag icon={<CloseCircleOutlined />} color="error">
|
<Tag icon={<CloseCircleOutlined />} color="error">
|
||||||
已禁用
|
已禁用
|
||||||
</Tag>
|
</Tag>
|
||||||
|
@ -194,9 +194,12 @@ const Crontab = () => {
|
||||||
.get(`${config.apiPrefix}crons?searchValue=${searchText}`)
|
.get(`${config.apiPrefix}crons?searchValue=${searchText}`)
|
||||||
.then((data: any) => {
|
.then((data: any) => {
|
||||||
setValue(
|
setValue(
|
||||||
data.data.sort(
|
data.data.sort((a: any, b: any) => {
|
||||||
(a: any, b: any) => CrontabSort[a.status] - CrontabSort[b.status],
|
if (a.status === b.status && a.status === CrontabStatus.idle) {
|
||||||
),
|
return a.isDisabled - b.isDisable;
|
||||||
|
}
|
||||||
|
return CrontabSort[a.status] - CrontabSort[b.status];
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
const runningTasks = data.data.filter(
|
const runningTasks = data.data.filter(
|
||||||
(x: any) => x.status !== CrontabStatus.idle,
|
(x: any) => x.status !== CrontabStatus.idle,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user