mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-08 20:52:29 +08:00
系统重启时会执行一次所有ql repo 和 ql raw的定时任务
This commit is contained in:
parent
ed9db7c8d5
commit
5ddc9ac22e
|
@ -1,3 +1,4 @@
|
||||||
|
import { exec } from 'child_process';
|
||||||
import { Container } from 'typedi';
|
import { Container } from 'typedi';
|
||||||
import { Crontab, CrontabStatus } from '../data/cron';
|
import { Crontab, CrontabStatus } from '../data/cron';
|
||||||
import CronService from '../services/cron';
|
import CronService from '../services/cron';
|
||||||
|
@ -48,6 +49,7 @@ export default async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// patch更新面板任务状态
|
||||||
cronDb.find({ name: '更新面板' }).exec((err, docs) => {
|
cronDb.find({ name: '更新面板' }).exec((err, docs) => {
|
||||||
const doc = docs[0];
|
const doc = docs[0];
|
||||||
if (doc && doc.status === CrontabStatus.running) {
|
if (doc && doc.status === CrontabStatus.running) {
|
||||||
|
@ -57,6 +59,18 @@ export default async () => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 初始化时执行一次所有的ql repo 任务
|
||||||
|
cronDb
|
||||||
|
.find({
|
||||||
|
command: /ql (repo|raw)/,
|
||||||
|
})
|
||||||
|
.exec((err, docs) => {
|
||||||
|
for (let i = 0; i < docs.length; i++) {
|
||||||
|
const doc = docs[i];
|
||||||
|
exec(doc.command);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function randomSchedule(from: number, to: number) {
|
function randomSchedule(from: number, to: number) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user