mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-07 11:56:08 +08:00
更新手动执行cron参数
This commit is contained in:
parent
7eba87aa2c
commit
df1dc4fcbb
|
@ -74,7 +74,7 @@ export default class CronService {
|
||||||
let logFile = `${config.manualLogPath}${res._id}.log`;
|
let logFile = `${config.manualLogPath}${res._id}.log`;
|
||||||
fs.writeFileSync(logFile, `${new Date().toString()}\n\n`);
|
fs.writeFileSync(logFile, `${new Date().toString()}\n\n`);
|
||||||
|
|
||||||
const cmd = spawn(res.command, { shell: true });
|
const cmd = spawn(`${res.command} now`, { shell: true });
|
||||||
|
|
||||||
this.cronDb.update({ _id }, { $set: { status: CrontabStatus.running } });
|
this.cronDb.update({ _id }, { $set: { status: CrontabStatus.running } });
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ add_cron_api() {
|
||||||
local name=$3
|
local name=$3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local api=$(curl "http://localhost:5678/api/crons?t=$currentTimeStamp" \
|
local api=$(curl "http://localhost:5600/api/crons?t=$currentTimeStamp" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Authorization: Bearer $token" \
|
-H "Authorization: Bearer $token" \
|
||||||
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" \
|
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" \
|
||||||
|
@ -55,7 +55,7 @@ add_cron_api() {
|
||||||
del_cron_api() {
|
del_cron_api() {
|
||||||
local id=$1
|
local id=$1
|
||||||
local currentTimeStamp=$(date +%s)
|
local currentTimeStamp=$(date +%s)
|
||||||
local api=$(curl "http://localhost:5678/api/crons/$id?t=$currentTimeStamp" \
|
local api=$(curl "http://localhost:5600/api/crons/$id?t=$currentTimeStamp" \
|
||||||
-X 'DELETE' \
|
-X 'DELETE' \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Authorization: Bearer $token" \
|
-H "Authorization: Bearer $token" \
|
||||||
|
|
|
@ -233,12 +233,10 @@ Add_Cron() {
|
||||||
echo -e "开始尝试自动添加定时任务\n"
|
echo -e "开始尝试自动添加定时任务\n"
|
||||||
JsAdd=$(cat $ListJsAdd)
|
JsAdd=$(cat $ListJsAdd)
|
||||||
for Cron in $JsAdd; do
|
for Cron in $JsAdd; do
|
||||||
local id=$(echo "$1" | awk -F ":" '{print $1}')
|
if [[ $Cron == jd_bean_sign ]]; then
|
||||||
local name=$(echo "$1" | awk -F ":" '{print $2}')
|
echo "4 0,9 * * * $ShellJs $Cron" >>$ListCronCurrent
|
||||||
if [[ $name == jd_bean_sign ]]; then
|
|
||||||
echo "4 0,9 * * * $ShellJs $name" >>$ListCronCurrent
|
|
||||||
else
|
else
|
||||||
param=$(cat $ListCronRemote | grep -E "\/$name\." | perl -pe "s|(^.+)node */scripts/(j[drx]_\w+)\.js.+|\1\:$ShellJs \2:\2|")
|
param=$(cat $ListCronRemote | grep -E "\/$Cron\." | perl -pe "s|(^.+)node */scripts/(j[drx]_\w+)\.js.+|\1\:$ShellJs \2:\2|")
|
||||||
add_cron_api "$param"
|
add_cron_api "$param"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user