@whyour/qinglong 2.22.0 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +3 -0
- package/README-NODE.md +10 -0
- package/back/protos/api.proto +10 -0
- package/cli/README.en.md +156 -0
- package/cli/README.md +156 -0
- package/cli/src/internal/maintenance/nodeRuntime.cjs +18 -0
- package/cli/src/internal/maintenance/panelUpgrade.cjs +577 -0
- package/cli/src/internal/maintenance/platformBundle.cjs +582 -0
- package/cli/src/internal/maintenance/upgradeArtifacts.cjs +979 -0
- package/cli/src/internal/maintenance/upgradePrestart.cjs +396 -0
- package/ecosystem.config.js +3 -0
- package/package.json +59 -15
- package/sample/notify.js +308 -135
- package/sample/notify.py +174 -27
- package/shell/api.sh +71 -74
- package/shell/install-bundle.cjs +320 -0
- package/shell/install-package.cjs +74 -0
- package/shell/lang/en.sh +38 -0
- package/shell/node-runtime-probe.cjs +62 -0
- package/shell/node_path_cache.sh +10 -2
- package/shell/otask.sh +41 -41
- package/shell/preload/client.js +1 -0
- package/shell/preload/notificationAudit.js +51 -0
- package/shell/preload/sitecustomize.js +9 -5
- package/shell/preload/sitecustomize.py +9 -7
- package/shell/rmlog.sh +21 -16
- package/shell/share.sh +62 -45
- package/shell/start-simplify.sh +90 -0
- package/shell/start.sh +48 -71
- package/shell/task-timeout.sh +75 -0
- package/shell/task.sh +14 -12
- package/shell/update.sh +92 -133
- package/shell/upgrade-lock.yaml +16122 -0
- package/shell/upgrade.cjs +8 -0
- package/static/build/api/clientIp.js +2 -1
- package/static/build/api/clientIp.js.map +1 -0
- package/static/build/api/config.js +2 -6
- package/static/build/api/config.js.map +1 -0
- package/static/build/api/cron.js.map +1 -0
- package/static/build/api/dashboard.js.map +1 -0
- package/static/build/api/dependence.js.map +1 -0
- package/static/build/api/env.js +15 -14
- package/static/build/api/env.js.map +1 -0
- package/static/build/api/health.js.map +1 -0
- package/static/build/api/index.js.map +1 -0
- package/static/build/api/log.js.map +1 -0
- package/static/build/api/open.js +2 -1
- package/static/build/api/open.js.map +1 -0
- package/static/build/api/retention.js.map +1 -0
- package/static/build/api/script.js +155 -9
- package/static/build/api/script.js.map +1 -0
- package/static/build/api/subscription.js +3 -6
- package/static/build/api/subscription.js.map +1 -0
- package/static/build/api/system.js +53 -3
- package/static/build/api/system.js.map +1 -0
- package/static/build/api/update.js.map +1 -0
- package/static/build/api/user.js.map +1 -0
- package/static/build/app.js +10 -23
- package/static/build/app.js.map +1 -0
- package/static/build/bootstrap/database.js.map +1 -0
- package/static/build/bootstrap/upgradeProbe.js +154 -0
- package/static/build/bootstrap/upgradeProbe.js.map +1 -0
- package/static/build/config/const.js +2 -1
- package/static/build/config/const.js.map +1 -0
- package/static/build/config/container.js.map +1 -0
- package/static/build/config/grpcCerts.js +89 -40
- package/static/build/config/grpcCerts.js.map +1 -0
- package/static/build/config/http.js.map +1 -0
- package/static/build/config/index.js.map +1 -0
- package/static/build/config/serverEnv.js.map +1 -0
- package/static/build/config/share.js.map +1 -0
- package/static/build/config/subscription.js +19 -11
- package/static/build/config/subscription.js.map +1 -0
- package/static/build/config/util.js +178 -77
- package/static/build/config/util.js.map +1 -0
- package/static/build/data/cron.js.map +1 -0
- package/static/build/data/cronStats.js.map +1 -0
- package/static/build/data/cronView.js.map +1 -0
- package/static/build/data/dependence.js.map +1 -0
- package/static/build/data/env.js.map +1 -0
- package/static/build/data/index.js.map +1 -0
- package/static/build/data/notify.js.map +1 -0
- package/static/build/data/open.js.map +1 -0
- package/static/build/data/runningInstance.js.map +1 -0
- package/static/build/data/sock.js.map +1 -0
- package/static/build/data/subscription.js.map +1 -0
- package/static/build/data/system.js +3 -1
- package/static/build/data/system.js.map +1 -0
- package/static/build/interface/schedule.js.map +1 -0
- package/static/build/loaders/app.js.map +1 -0
- package/static/build/loaders/bootAfter.js.map +1 -0
- package/static/build/loaders/db.js.map +1 -0
- package/static/build/loaders/depInjector.js.map +1 -0
- package/static/build/loaders/deps.js.map +1 -0
- package/static/build/loaders/express.js +10 -3
- package/static/build/loaders/express.js.map +1 -0
- package/static/build/loaders/httpApplication.js +55 -0
- package/static/build/loaders/httpApplication.js.map +1 -0
- package/static/build/loaders/initData.js +20 -30
- package/static/build/loaders/initData.js.map +1 -0
- package/static/build/loaders/initFile.js.map +1 -0
- package/static/build/loaders/initTask.js +11 -1
- package/static/build/loaders/initTask.js.map +1 -0
- package/static/build/loaders/logger.js.map +1 -0
- package/static/build/loaders/server.js.map +1 -0
- package/static/build/loaders/sock.js.map +1 -0
- package/static/build/middlewares/monitoring.js.map +1 -0
- package/static/build/middlewares/protectedPathCase.js.map +1 -0
- package/static/build/middlewares/uniqueConstraintError.js +15 -0
- package/static/build/middlewares/uniqueConstraintError.js.map +1 -0
- package/static/build/middlewares/validationErrors.js +17 -0
- package/static/build/middlewares/validationErrors.js.map +1 -0
- package/static/build/protos/api.js +140 -2
- package/static/build/protos/api.js.map +1 -0
- package/static/build/protos/cron.js +63 -2
- package/static/build/protos/cron.js.map +1 -0
- package/static/build/protos/health.js.map +1 -0
- package/static/build/schedule/addCron.js +45 -63
- package/static/build/schedule/addCron.js.map +1 -0
- package/static/build/schedule/api.js +21 -2
- package/static/build/schedule/api.js.map +1 -0
- package/static/build/schedule/client.js +19 -1
- package/static/build/schedule/client.js.map +1 -0
- package/static/build/schedule/data.js.map +1 -0
- package/static/build/schedule/delCron.js +6 -4
- package/static/build/schedule/delCron.js.map +1 -0
- package/static/build/schedule/health.js.map +1 -0
- package/static/build/schedule/setConcurrency.js +27 -0
- package/static/build/schedule/setConcurrency.js.map +1 -0
- package/static/build/services/config.js +2 -3
- package/static/build/services/config.js.map +1 -0
- package/static/build/services/cron.js +43 -17
- package/static/build/services/cron.js.map +1 -0
- package/static/build/services/cronView.js.map +1 -0
- package/static/build/services/dependence.js +48 -13
- package/static/build/services/dependence.js.map +1 -0
- package/static/build/services/env.js +1 -1
- package/static/build/services/env.js.map +1 -0
- package/static/build/services/grpc.js +4 -3
- package/static/build/services/grpc.js.map +1 -0
- package/static/build/services/health.js +2 -0
- package/static/build/services/health.js.map +1 -0
- package/static/build/services/http.js.map +1 -0
- package/static/build/services/log.js +1 -1
- package/static/build/services/log.js.map +1 -0
- package/static/build/services/metrics.js +2 -1
- package/static/build/services/metrics.js.map +1 -0
- package/static/build/services/notify.js +45 -24
- package/static/build/services/notify.js.map +1 -0
- package/static/build/services/open.js +106 -31
- package/static/build/services/open.js.map +1 -0
- package/static/build/services/retention.js.map +1 -0
- package/static/build/services/schedule.js +32 -21
- package/static/build/services/schedule.js.map +1 -0
- package/static/build/services/script.js +1 -1
- package/static/build/services/script.js.map +1 -0
- package/static/build/services/scriptHistory.js +30 -0
- package/static/build/services/scriptHistory.js.map +1 -0
- package/static/build/services/sock.js.map +1 -0
- package/static/build/services/sshKey.js +45 -17
- package/static/build/services/sshKey.js.map +1 -0
- package/static/build/services/subscription.js +104 -53
- package/static/build/services/subscription.js.map +1 -0
- package/static/build/services/system.js +139 -74
- package/static/build/services/system.js.map +1 -0
- package/static/build/services/user.js +17 -12
- package/static/build/services/user.js.map +1 -0
- package/static/build/shared/auth.js.map +1 -0
- package/static/build/shared/authMutation.js.map +1 -0
- package/static/build/shared/childProcess.js.map +1 -0
- package/static/build/shared/clientIp.js.map +1 -0
- package/static/build/shared/cronCommand.js +17 -0
- package/static/build/shared/cronCommand.js.map +1 -0
- package/static/build/shared/cronSchedule.js +157 -0
- package/static/build/shared/cronSchedule.js.map +1 -0
- package/static/build/shared/cronScheduler.js +74 -0
- package/static/build/shared/cronScheduler.js.map +1 -0
- package/static/build/shared/errors.js.map +1 -0
- package/static/build/shared/fileAccess.js.map +1 -0
- package/static/build/shared/i18n.js +167 -87
- package/static/build/shared/i18n.js.map +1 -0
- package/static/build/shared/interface.js.map +1 -0
- package/static/build/shared/languageSync.js +61 -0
- package/static/build/shared/languageSync.js.map +1 -0
- package/static/build/shared/linuxMirror.js +96 -0
- package/static/build/shared/linuxMirror.js.map +1 -0
- package/static/build/shared/logPath.js +15 -0
- package/static/build/shared/logPath.js.map +1 -0
- package/static/build/shared/logReader.js.map +1 -0
- package/static/build/shared/logStreamManager.js.map +1 -0
- package/static/build/shared/loginThrottle.js +45 -0
- package/static/build/shared/loginThrottle.js.map +1 -0
- package/static/build/shared/notificationAudit.js +46 -0
- package/static/build/shared/notificationAudit.js.map +1 -0
- package/static/build/shared/pLimit.js +27 -14
- package/static/build/shared/pLimit.js.map +1 -0
- package/static/build/shared/password.js.map +1 -0
- package/static/build/shared/retention.js.map +1 -0
- package/static/build/shared/runCron.js +81 -29
- package/static/build/shared/runCron.js.map +1 -0
- package/static/build/shared/runtimeBuild.js +44 -0
- package/static/build/shared/runtimeBuild.js.map +1 -0
- package/static/build/shared/schedulerMutationLock.js.map +1 -0
- package/static/build/shared/schedulerReadiness.js.map +1 -0
- package/static/build/shared/schemaMigrations.js.map +1 -0
- package/static/build/shared/scriptHistory.js +445 -0
- package/static/build/shared/scriptHistory.js.map +1 -0
- package/static/build/shared/shellQuote.js +11 -0
- package/static/build/shared/shellQuote.js.map +1 -0
- package/static/build/shared/startupProcess.js.map +1 -0
- package/static/build/shared/store.js.map +1 -0
- package/static/build/shared/subscriptionMutationLock.js +34 -0
- package/static/build/shared/subscriptionMutationLock.js.map +1 -0
- package/static/build/shared/subscriptionPath.js +41 -0
- package/static/build/shared/subscriptionPath.js.map +1 -0
- package/static/build/shared/subscriptionStorage.js +98 -0
- package/static/build/shared/subscriptionStorage.js.map +1 -0
- package/static/build/shared/trustProxy.js +5 -4
- package/static/build/shared/trustProxy.js.map +1 -0
- package/static/build/shared/utils.js +2 -1
- package/static/build/shared/utils.js.map +1 -0
- package/static/build/token.js +3 -14
- package/static/build/token.js.map +1 -0
- package/static/build/validation/schedule.js +22 -19
- package/static/build/validation/schedule.js.map +1 -0
- package/static/build-info.json +754 -0
- package/static/dist/1089.0ecc5383.async.js.gz +0 -0
- package/static/dist/1174.41a43fee.async.js.gz +0 -0
- package/static/dist/119.89e2d610.async.js.gz +0 -0
- package/static/dist/1212.f87fd07a.async.js.gz +0 -0
- package/static/dist/1352.96a77e1d.async.js.gz +0 -0
- package/static/dist/1379.f91563a1.async.js.gz +0 -0
- package/static/dist/1571.94ddca13.async.js.gz +0 -0
- package/static/dist/1706.ac98cb3f.async.js.gz +0 -0
- package/static/dist/1765.5ac01a93.async.js.gz +0 -0
- package/static/dist/1836.f0b74cf1.async.js.gz +0 -0
- package/static/dist/1883.675b6a18.chunk.css.gz +0 -0
- package/static/dist/1885.b8f427bf.async.js.gz +0 -0
- package/static/dist/1887.9e0d3da8.async.js.gz +0 -0
- package/static/dist/1967.3f3945d0.async.js.gz +0 -0
- package/static/dist/198.db47fc1a.async.js.gz +0 -0
- package/static/dist/2325.dfa32834.async.js.gz +0 -0
- package/static/dist/2338.d678967d.async.js.gz +0 -0
- package/static/dist/2372.b5a50ee7.async.js +1 -0
- package/static/dist/2372.b5a50ee7.async.js.gz +0 -0
- package/static/dist/2476.4e9b0992.async.js.gz +0 -0
- package/static/dist/2537.2b262ee0.async.js.gz +0 -0
- package/static/dist/2577.aa8fe709.async.js.gz +0 -0
- package/static/dist/2635.d4c59d23.async.js.gz +0 -0
- package/static/dist/2664.e69530fb.async.js +1 -0
- package/static/dist/2664.e69530fb.async.js.gz +0 -0
- package/static/dist/2693.51c2636b.async.js.gz +0 -0
- package/static/dist/2808.cdc0995c.async.js.gz +0 -0
- package/static/dist/2821.651f31e5.async.js.gz +0 -0
- package/static/dist/2890.add55e85.async.js.gz +0 -0
- package/static/dist/2901.6d0de54e.async.js +1 -0
- package/static/dist/2901.6d0de54e.async.js.gz +0 -0
- package/static/dist/292.1b962b29.chunk.css.gz +0 -0
- package/static/dist/292.27ce781f.async.js +1 -0
- package/static/dist/292.27ce781f.async.js.gz +0 -0
- package/static/dist/300.08ac9875.async.js.gz +0 -0
- package/static/dist/3191.3b7e4b42.async.js +1 -0
- package/static/dist/3191.3b7e4b42.async.js.gz +0 -0
- package/static/dist/3382.a584a111.async.js.gz +0 -0
- package/static/dist/3383.041eee73.async.js.gz +0 -0
- package/static/dist/3512.95e41255.async.js +1 -0
- package/static/dist/3512.95e41255.async.js.gz +0 -0
- package/static/dist/3714.8d6dba9e.async.js.gz +0 -0
- package/static/dist/3906.a5eee612.async.js.gz +0 -0
- package/static/dist/3948.4fe809fd.async.js.gz +0 -0
- package/static/dist/4324.5a5887d1.async.js.gz +0 -0
- package/static/dist/4559.faab3673.async.js.gz +0 -0
- package/static/dist/4573.16f19278.async.js.gz +0 -0
- package/static/dist/{4736.1d2b5cb6.async.js → 4736.7c4c489b.async.js} +1 -1
- package/static/dist/4736.7c4c489b.async.js.gz +0 -0
- package/static/dist/4887.8e3ae573.async.js.gz +0 -0
- package/static/dist/4934.f3539d08.async.js.gz +0 -0
- package/static/dist/5077.cbd111cd.async.js.gz +0 -0
- package/static/dist/{5481.624d0e07.async.js → 5481.e2945a63.async.js} +1 -1
- package/static/dist/5481.e2945a63.async.js.gz +0 -0
- package/static/dist/5662.678b0cfb.async.js.gz +0 -0
- package/static/dist/5970.5862e59e.async.js +1 -0
- package/static/dist/5970.5862e59e.async.js.gz +0 -0
- package/static/dist/6013.db535339.async.js.gz +0 -0
- package/static/dist/6035.32ebfad9.async.js.gz +0 -0
- package/static/dist/6212.30a9c190.async.js +1 -0
- package/static/dist/6212.30a9c190.async.js.gz +0 -0
- package/static/dist/6341.673fb65c.async.js.gz +0 -0
- package/static/dist/6367.8b0e838c.async.js.gz +0 -0
- package/static/dist/6431.c50479be.async.js +1 -0
- package/static/dist/6569.55177f6a.async.js.gz +0 -0
- package/static/dist/6610.c111af7e.async.js.gz +0 -0
- package/static/dist/6638.87a163d2.async.js.gz +0 -0
- package/static/dist/6646.95e92533.async.js.gz +0 -0
- package/static/dist/{6872.a503ef55.async.js → 6872.fcc9ce17.async.js} +1 -1
- package/static/dist/6872.fcc9ce17.async.js.gz +0 -0
- package/static/dist/691.187a388c.async.js.gz +0 -0
- package/static/dist/7146.4dc150b1.async.js +1 -0
- package/static/dist/7146.4dc150b1.async.js.gz +0 -0
- package/static/dist/7231.f7e5b668.async.js.gz +0 -0
- package/static/dist/7253.4b9bf133.async.js.gz +0 -0
- package/static/dist/7278.96bf439f.async.js.gz +0 -0
- package/static/dist/7355.fca746f5.async.js.gz +0 -0
- package/static/dist/7384.1bb449d5.async.js.gz +0 -0
- package/static/dist/7508.3fffed15.chunk.css.gz +0 -0
- package/static/dist/7508.d90eac63.async.js.gz +0 -0
- package/static/dist/7802.34255805.async.js.gz +0 -0
- package/static/dist/7984.eaac7402.async.js.gz +0 -0
- package/static/dist/8033.5cb31493.async.js.gz +0 -0
- package/static/dist/8078.8586c875.async.js.gz +0 -0
- package/static/dist/8147.2fb55202.async.js.gz +0 -0
- package/static/dist/8187.48c130d6.async.js.gz +0 -0
- package/static/dist/8495.d53e15ca.async.js.gz +0 -0
- package/static/dist/8844.a0fef08e.async.js.gz +0 -0
- package/static/dist/9308.3202ac13.async.js.gz +0 -0
- package/static/dist/9323.a33f47da.async.js.gz +0 -0
- package/static/dist/965.8d9b1fbd.async.js +1 -0
- package/static/dist/965.8d9b1fbd.async.js.gz +0 -0
- package/static/dist/9761.360a19d8.async.js.gz +0 -0
- package/static/dist/index.html +2 -2
- package/static/dist/layouts__index.86b6bcbe.chunk.css +1 -0
- package/static/dist/layouts__index.86b6bcbe.chunk.css.gz +0 -0
- package/static/dist/layouts__index.c8e9788e.async.js +1 -0
- package/static/dist/layouts__index.c8e9788e.async.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/base/worker/workerMain.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/abap/abap.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/clojure/clojure.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/elixir/elixir.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/freemarker2/freemarker2.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/mysql/mysql.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/pgsql/pgsql.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/powerquery/powerquery.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/redshift/redshift.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/solidity/solidity.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/sql/sql.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.css.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.de.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.es.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.fr.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.it.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.ja.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.ko.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.ru.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.zh-cn.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.zh-tw.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/css/cssMode.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/css/cssWorker.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/html/htmlMode.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/html/htmlWorker.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/json/jsonMode.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/json/jsonWorker.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/typescript/tsMode.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/typescript/tsWorker.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/loader.js.gz +0 -0
- package/static/dist/preload_helper.8b8f6581.js +1 -0
- package/static/dist/src__pages__404.3fd8332e.async.js +1 -0
- package/static/dist/src__pages__config__index.d18d8f95.async.js +1 -0
- package/static/dist/src__pages__crontab__detail.88729e8f.async.js +1 -0
- package/static/dist/src__pages__crontab__detail.88729e8f.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__index.8aa9d297.async.js +1 -0
- package/static/dist/src__pages__crontab__index.8aa9d297.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__logModal.930535e2.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__modal.a2c8fdcc.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__viewCreateModal.7b4f9cbe.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__viewManageModal.cd454ea0.async.js.gz +0 -0
- package/static/dist/src__pages__dashboard__index.c05ce904.async.js +1 -0
- package/static/dist/src__pages__dashboard__index.c05ce904.async.js.gz +0 -0
- package/static/dist/src__pages__dependence__index.5b7fd97d.async.js +1 -0
- package/static/dist/src__pages__dependence__index.5b7fd97d.async.js.gz +0 -0
- package/static/dist/{src__pages__dependence__logModal.154efe7a.async.js → src__pages__dependence__logModal.01729f63.async.js} +1 -1
- package/static/dist/src__pages__dependence__logModal.01729f63.async.js.gz +0 -0
- package/static/dist/src__pages__dependence__modal.ef7ae53b.async.js +1 -0
- package/static/dist/src__pages__dependence__modal.ef7ae53b.async.js.gz +0 -0
- package/static/dist/src__pages__diff__index.4233ea93.async.js +1 -0
- package/static/dist/src__pages__diff__index.4233ea93.async.js.gz +0 -0
- package/static/dist/src__pages__env__index.eddb35bf.async.js +1 -0
- package/static/dist/src__pages__env__index.eddb35bf.async.js.gz +0 -0
- package/static/dist/src__pages__env__modal.4d71adb3.async.js.gz +0 -0
- package/static/dist/src__pages__error__index.66605c72.async.js +1 -0
- package/static/dist/src__pages__initialization__index.9c1c5b76.async.js +1 -0
- package/static/dist/src__pages__initialization__index.9c1c5b76.async.js.gz +0 -0
- package/static/dist/src__pages__log__index.71250e0d.async.js.gz +0 -0
- package/static/dist/src__pages__login__index.58bb4b38.async.js +1 -0
- package/static/dist/src__pages__login__index.58bb4b38.async.js.gz +0 -0
- package/static/dist/src__pages__script__components__UnsupportedFilePreview__index.c347a13a.async.js.gz +0 -0
- package/static/dist/src__pages__script__editModal.d15f8d78.async.js +1 -0
- package/static/dist/src__pages__script__editModal.d15f8d78.async.js.gz +0 -0
- package/static/dist/src__pages__script__editNameModal.789ad87b.async.js +1 -0
- package/static/dist/src__pages__script__editNameModal.789ad87b.async.js.gz +0 -0
- package/static/dist/src__pages__script__historyDrawer.8c58d958.async.js +1 -0
- package/static/dist/src__pages__script__historyDrawer.8c58d958.async.js.gz +0 -0
- package/static/dist/src__pages__script__historyDrawer.a449193a.chunk.css +1 -0
- package/static/dist/src__pages__script__index.96a6d30f.async.js +1 -0
- package/static/dist/src__pages__script__index.96a6d30f.async.js.gz +0 -0
- package/static/dist/src__pages__script__index.ab360776.chunk.css +1 -0
- package/static/dist/src__pages__script__saveModal.8fca1a22.async.js +1 -0
- package/static/dist/src__pages__script__saveWithHistory.99ece830.async.js +1 -0
- package/static/dist/{src__pages__setting__about.e6db5090.chunk.css → src__pages__setting__about.0d6ea255.chunk.css} +1 -1
- package/static/dist/src__pages__setting__about.3d3c019f.async.js.gz +0 -0
- package/static/dist/src__pages__setting__checkUpdate.429a42f3.async.js +1 -0
- package/static/dist/src__pages__setting__checkUpdate.429a42f3.async.js.gz +0 -0
- package/static/dist/src__pages__setting__clientIp.3a8711ed.async.js.gz +0 -0
- package/static/dist/{src__pages__setting__dependence.28ecea01.chunk.css → src__pages__setting__dependence.80b183a5.chunk.css} +1 -1
- package/static/dist/src__pages__setting__dependence.c227c0f5.async.js +1 -0
- package/static/dist/src__pages__setting__dependence.c227c0f5.async.js.gz +0 -0
- package/static/dist/src__pages__setting__index.274ad415.async.js +1 -0
- package/static/dist/src__pages__setting__index.274ad415.async.js.gz +0 -0
- package/static/dist/{src__pages__setting__index.7cf46d4a.chunk.css → src__pages__setting__index.46315660.chunk.css} +1 -1
- package/static/dist/src__pages__setting__loginLog.ef135f19.async.js +1 -0
- package/static/dist/src__pages__setting__loginLog.ef135f19.async.js.gz +0 -0
- package/static/dist/src__pages__setting__notifyLog.5ef5b578.async.js +1 -0
- package/static/dist/src__pages__setting__notifyLog.5ef5b578.async.js.gz +0 -0
- package/static/dist/{src__pages__setting__other.28ecea01.chunk.css → src__pages__setting__notifyLog.80b183a5.chunk.css} +1 -1
- package/static/dist/src__pages__setting__other.80b183a5.chunk.css +1 -0
- package/static/dist/src__pages__setting__other.e744c0d1.async.js +1 -0
- package/static/dist/src__pages__setting__other.e744c0d1.async.js.gz +0 -0
- package/static/dist/src__pages__setting__security.e2d71ebb.async.js.gz +0 -0
- package/static/dist/src__pages__setting__systemLog.000bcb5e.async.js +1 -0
- package/static/dist/src__pages__setting__systemLog.000bcb5e.async.js.gz +0 -0
- package/static/dist/src__pages__subscription__index.f556ae4c.async.js +1 -0
- package/static/dist/src__pages__subscription__index.f556ae4c.async.js.gz +0 -0
- package/static/dist/src__pages__subscription__logModal.cdba5139.async.js.gz +0 -0
- package/static/dist/src__pages__subscription__modal.8f04f506.async.js +1 -0
- package/static/dist/umi.73936e34.js +1 -0
- package/static/dist/umi.73936e34.js.gz +0 -0
- package/static/dist/umi.a4d14b92.css.gz +0 -0
- package/version.yaml +11 -19
- package/.dockerignore +0 -13
- package/AGENTS.md +0 -43
- package/SECURITY.md +0 -5
- package/back/protos/cron.proto +0 -29
- package/back/protos/health.proto +0 -22
- package/deploy/kubernetes/README.md +0 -81
- package/deploy/kubernetes/base/kustomization.yaml +0 -5
- package/deploy/kubernetes/base/qinglong.yaml +0 -95
- package/deploy/kubernetes/overlays/example/kustomization.yaml +0 -10
- package/docker/Dockerfile +0 -113
- package/docker/Dockerfile.310 +0 -113
- package/docker/Dockerfile.debian +0 -128
- package/docker/Dockerfile.debian310 +0 -130
- package/docker/build-manifest.cjs +0 -28
- package/docker/docker-compose.yml +0 -10
- package/docker/docker-entrypoint.sh +0 -147
- package/docker/verify-build.cjs +0 -49
- package/docs/PROJECT_ARCHITECTURE.md +0 -550
- package/docs/releases/2.22.0-validation.md +0 -49
- package/docs/releases/2.22.0.md +0 -54
- package/sample/tool.ts +0 -40
- package/scripts/benchmark-execution.cjs +0 -96
- package/scripts/write-build-info.cjs +0 -27
- package/shell/pub.sh +0 -28
- package/static/dist/2096.6d98fd12.async.js +0 -1
- package/static/dist/255.8a80b983.async.js +0 -1
- package/static/dist/2901.2ca95295.async.js +0 -1
- package/static/dist/3600.7637c822.async.js +0 -1
- package/static/dist/445.a65ff63b.async.js +0 -1
- package/static/dist/4859.97d6653c.async.js +0 -1
- package/static/dist/5970.d3a6e7bd.async.js +0 -1
- package/static/dist/6212.9e6d9913.async.js +0 -1
- package/static/dist/6431.4603ad0e.async.js +0 -1
- package/static/dist/6707.801b886b.async.js +0 -1
- package/static/dist/9066.605168f8.async.js +0 -1
- package/static/dist/9313.37acaf13.async.js +0 -1
- package/static/dist/layouts__index.633d3553.async.js +0 -1
- package/static/dist/layouts__index.adf0692f.chunk.css +0 -1
- package/static/dist/preload_helper.cf7de3fa.js +0 -1
- package/static/dist/src__pages__404.771168fc.async.js +0 -1
- package/static/dist/src__pages__config__index.9aba4054.async.js +0 -1
- package/static/dist/src__pages__crontab__detail.86b2eebb.async.js +0 -1
- package/static/dist/src__pages__crontab__index.ae4e06f2.async.js +0 -1
- package/static/dist/src__pages__dashboard__index.243c5a35.async.js +0 -1
- package/static/dist/src__pages__dependence__index.874d501f.async.js +0 -1
- package/static/dist/src__pages__dependence__modal.a29c1a0f.async.js +0 -1
- package/static/dist/src__pages__diff__index.1714b941.async.js +0 -1
- package/static/dist/src__pages__env__index.fd6fd2b0.async.js +0 -1
- package/static/dist/src__pages__error__index.aae50c94.async.js +0 -1
- package/static/dist/src__pages__initialization__index.82a2e967.async.js +0 -1
- package/static/dist/src__pages__login__index.a0fd5ed8.async.js +0 -1
- package/static/dist/src__pages__script__editModal.22acdf7c.async.js +0 -1
- package/static/dist/src__pages__script__editNameModal.1a521cc0.async.js +0 -1
- package/static/dist/src__pages__script__index.60b6f827.chunk.css +0 -1
- package/static/dist/src__pages__script__index.a18b2692.async.js +0 -1
- package/static/dist/src__pages__script__saveModal.8965b74c.async.js +0 -1
- package/static/dist/src__pages__setting__checkUpdate.d175b154.async.js +0 -1
- package/static/dist/src__pages__setting__dependence.9c0f749b.async.js +0 -1
- package/static/dist/src__pages__setting__index.cb397741.async.js +0 -1
- package/static/dist/src__pages__setting__loginLog.e0a1f54d.async.js +0 -1
- package/static/dist/src__pages__setting__other.3d0b8492.async.js +0 -1
- package/static/dist/src__pages__setting__systemLog.b3046955.async.js +0 -1
- package/static/dist/src__pages__subscription__index.43086a06.async.js +0 -1
- package/static/dist/src__pages__subscription__modal.38991e1e.async.js +0 -1
- package/static/dist/umi.fc019050.js +0 -1
- package/test/back/auth-security.test.cjs +0 -74
- package/test/back/build-provenance.test.cjs +0 -150
- package/test/back/cron-log-name.test.cjs +0 -110
- package/test/back/cron-validation.test.cjs +0 -45
- package/test/back/dashboard-failures.test.cjs +0 -173
- package/test/back/database-bootstrap.test.cjs +0 -193
- package/test/back/dependence-cache-status.test.cjs +0 -125
- package/test/back/deprecated-file-routes.test.cjs +0 -82
- package/test/back/ecosystem.test.cjs +0 -28
- package/test/back/env-name-parsing.test.cjs +0 -96
- package/test/back/execution-lifecycle.test.cjs +0 -236
- package/test/back/file-access-security.test.cjs +0 -47
- package/test/back/fileTreeListing.test.cjs +0 -57
- package/test/back/grpc-cron-response.test.cjs +0 -60
- package/test/back/http-exclusive-listen.test.cjs +0 -31
- package/test/back/http-security.test.cjs +0 -213
- package/test/back/listen-security.test.cjs +0 -67
- package/test/back/log-path-security.test.cjs +0 -158
- package/test/back/logReader.test.cjs +0 -72
- package/test/back/manual-execution.test.cjs +0 -85
- package/test/back/manual-stop-claim.test.cjs +0 -220
- package/test/back/metrics.test.cjs +0 -34
- package/test/back/monitoring.test.cjs +0 -73
- package/test/back/node-path-cache.test.cjs +0 -173
- package/test/back/node-path-lock.test.cjs +0 -178
- package/test/back/npm-publication.test.cjs +0 -70
- package/test/back/primary-apm.test.cjs +0 -24
- package/test/back/process-exit-state.test.cjs +0 -81
- package/test/back/process-stop-signal.test.cjs +0 -77
- package/test/back/protected-path-case.test.cjs +0 -58
- package/test/back/qlServiceLogCommand.test.cjs +0 -128
- package/test/back/retention.test.cjs +0 -131
- package/test/back/role-loading.test.cjs +0 -118
- package/test/back/schedule-health.test.cjs +0 -86
- package/test/back/scheduler-file-lock.test.cjs +0 -51
- package/test/back/scheduler-mutation.test.cjs +0 -312
- package/test/back/scheduler-readiness.test.cjs +0 -85
- package/test/back/scheduler-reconciliation.test.cjs +0 -152
- package/test/back/scheduler-rpc-timeout.test.cjs +0 -49
- package/test/back/schema-migrations.test.cjs +0 -127
- package/test/back/shell-api-parsing.test.cjs +0 -184
- package/test/back/sock-polling.test.cjs +0 -297
- package/test/back/sock-security.test.cjs +0 -72
- package/test/back/start-env-preservation.test.cjs +0 -53
- package/test/back/stop-failure-feedback.test.cjs +0 -158
- package/test/back/stop-race.test.cjs +0 -167
- package/test/back/subscription-cleanup.test.cjs +0 -53
- package/test/back/subscription-stop-state.test.cjs +0 -66
- package/test/back/system-dependence-cache.test.cjs +0 -126
- package/test/back/task-time.test.cjs +0 -116
- package/test/back/user-api.test.cjs +0 -99
- package/test/back/user-security.test.cjs +0 -248
- package/test/back/worker-apm.test.cjs +0 -84
- package/test/back/wpush-grpc.test.cjs +0 -115
- package/test/front/cron-log-pagination.test.cjs +0 -214
- package/test/front/http-auth.test.cjs +0 -152
- package/test/front/http-error.test.cjs +0 -29
- package/test/helpers/load-security-module.cjs +0 -42
- /package/static/dist/{4859.1b962b29.chunk.css → 292.1b962b29.chunk.css} +0 -0
package/shell/share.sh
CHANGED
|
@@ -77,16 +77,19 @@ load_ql_envs() {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
import_config() {
|
|
80
|
-
[[ -f $file_config_user ]] && . $file_config_user
|
|
81
|
-
[[ -f $dir_preload/lang_env.sh ]] && . $dir_preload/lang_env.sh
|
|
80
|
+
[[ -f $file_config_user ]] && . "$file_config_user"
|
|
81
|
+
[[ -f $dir_preload/lang_env.sh ]] && . "$dir_preload/lang_env.sh"
|
|
82
82
|
|
|
83
|
-
#
|
|
83
|
+
# Language packs need global associative arrays (Bash 4.2+). Probe the
|
|
84
|
+
# capability so Bash 3.2 and 4.0/4.1 retain the Chinese-key fallback.
|
|
84
85
|
local lang=${QL_LANG:-zh}
|
|
85
86
|
local lang_file="$dir_shell/lang/${lang}.sh"
|
|
86
|
-
if
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
if (declare -gA __ql_lang_probe) 2>/dev/null; then
|
|
88
|
+
if [[ -f $lang_file ]]; then
|
|
89
|
+
. "$lang_file"
|
|
90
|
+
elif [[ -f "$dir_shell/lang/zh.sh" ]]; then
|
|
91
|
+
. "$dir_shell/lang/zh.sh"
|
|
92
|
+
fi
|
|
90
93
|
fi
|
|
91
94
|
|
|
92
95
|
load_ql_envs
|
|
@@ -110,7 +113,7 @@ t() {
|
|
|
110
113
|
fi
|
|
111
114
|
[[ -z $msg ]] && msg="$key"
|
|
112
115
|
# shellcheck disable=SC2059
|
|
113
|
-
printf "$msg\n" "$@"
|
|
116
|
+
printf -- "$msg\n" "$@"
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
set_proxy() {
|
|
@@ -132,7 +135,7 @@ unset_proxy() {
|
|
|
132
135
|
make_dir() {
|
|
133
136
|
local dir=$1
|
|
134
137
|
if [[ ! -d $dir ]]; then
|
|
135
|
-
mkdir -p $dir
|
|
138
|
+
mkdir -p -- "$dir"
|
|
136
139
|
fi
|
|
137
140
|
}
|
|
138
141
|
|
|
@@ -176,57 +179,57 @@ define_cmd() {
|
|
|
176
179
|
}
|
|
177
180
|
|
|
178
181
|
fix_config() {
|
|
179
|
-
make_dir $dir_tmp
|
|
180
|
-
make_dir $dir_static
|
|
181
|
-
make_dir $dir_data
|
|
182
|
-
make_dir $dir_config
|
|
183
|
-
make_dir $dir_log
|
|
184
|
-
make_dir $dir_db
|
|
185
|
-
make_dir $dir_scripts
|
|
186
|
-
make_dir $dir_list_tmp
|
|
187
|
-
make_dir $dir_repo
|
|
188
|
-
make_dir $dir_raw
|
|
189
|
-
make_dir $dir_update_log
|
|
190
|
-
make_dir $dir_dep
|
|
182
|
+
make_dir "$dir_tmp"
|
|
183
|
+
make_dir "$dir_static"
|
|
184
|
+
make_dir "$dir_data"
|
|
185
|
+
make_dir "$dir_config"
|
|
186
|
+
make_dir "$dir_log"
|
|
187
|
+
make_dir "$dir_db"
|
|
188
|
+
make_dir "$dir_scripts"
|
|
189
|
+
make_dir "$dir_list_tmp"
|
|
190
|
+
make_dir "$dir_repo"
|
|
191
|
+
make_dir "$dir_raw"
|
|
192
|
+
make_dir "$dir_update_log"
|
|
193
|
+
make_dir "$dir_dep"
|
|
191
194
|
|
|
192
195
|
if [[ ! -s $file_config_user ]]; then
|
|
193
|
-
cp -f $file_config_sample $file_config_user
|
|
196
|
+
cp -f "$file_config_sample" "$file_config_user"
|
|
194
197
|
fi
|
|
195
198
|
|
|
196
199
|
if [[ ! -f $file_task_before ]]; then
|
|
197
|
-
cp -f $file_task_sample $file_task_before
|
|
200
|
+
cp -f "$file_task_sample" "$file_task_before"
|
|
198
201
|
fi
|
|
199
202
|
|
|
200
203
|
if [[ ! -f $file_task_after ]]; then
|
|
201
|
-
cp -f $file_task_sample $file_task_after
|
|
204
|
+
cp -f "$file_task_sample" "$file_task_after"
|
|
202
205
|
fi
|
|
203
206
|
|
|
204
207
|
if [[ ! -f $file_extra_shell ]]; then
|
|
205
|
-
cp -f $file_extra_sample $file_extra_shell
|
|
208
|
+
cp -f "$file_extra_sample" "$file_extra_shell"
|
|
206
209
|
fi
|
|
207
210
|
|
|
208
211
|
if [[ ! -s $file_notify_py ]]; then
|
|
209
|
-
cp -f $file_notify_py_sample $file_notify_py
|
|
212
|
+
cp -f "$file_notify_py_sample" "$file_notify_py"
|
|
210
213
|
fi
|
|
211
214
|
|
|
212
215
|
if [[ ! -s $file_notify_js ]]; then
|
|
213
|
-
cp -f $file_notify_js_sample $file_notify_js
|
|
216
|
+
cp -f "$file_notify_js_sample" "$file_notify_js"
|
|
214
217
|
fi
|
|
215
218
|
|
|
216
219
|
if [[ ! -s $file_test_js ]]; then
|
|
217
|
-
cp -f $file_test_js_sample $file_test_js
|
|
220
|
+
cp -f "$file_test_js_sample" "$file_test_js"
|
|
218
221
|
fi
|
|
219
222
|
|
|
220
223
|
if [[ ! -s $file_test_py ]]; then
|
|
221
|
-
cp -f $file_test_py_sample $file_test_py
|
|
224
|
+
cp -f "$file_test_py_sample" "$file_test_py"
|
|
222
225
|
fi
|
|
223
226
|
|
|
224
227
|
if [[ ! -s $dep_notify_js ]]; then
|
|
225
|
-
cp -f $file_notify_js_sample $dep_notify_js
|
|
228
|
+
cp -f "$file_notify_js_sample" "$dep_notify_js"
|
|
226
229
|
fi
|
|
227
230
|
|
|
228
231
|
if [[ ! -s $dep_notify_py ]]; then
|
|
229
|
-
cp -f $file_notify_py_sample $dep_notify_py
|
|
232
|
+
cp -f "$file_notify_py_sample" "$dep_notify_py"
|
|
230
233
|
fi
|
|
231
234
|
|
|
232
235
|
}
|
|
@@ -246,17 +249,17 @@ npm_install_2() {
|
|
|
246
249
|
local dir_current=$(pwd)
|
|
247
250
|
local dir_work=$1
|
|
248
251
|
|
|
249
|
-
cd $dir_work
|
|
252
|
+
cd "$dir_work" || return $?
|
|
250
253
|
t '安装 %s 依赖包...\n' "$dir_work"
|
|
251
254
|
npm_install_sub
|
|
252
|
-
cd $dir_current
|
|
255
|
+
cd "$dir_current" || return $?
|
|
253
256
|
}
|
|
254
257
|
|
|
255
258
|
diff_and_copy() {
|
|
256
259
|
local copy_source=$1
|
|
257
260
|
local copy_to=$2
|
|
258
|
-
if [[ ! -s $copy_to ]] || [[ $(diff $copy_source $copy_to) ]]; then
|
|
259
|
-
cp -f $copy_source $copy_to
|
|
261
|
+
if [[ ! -s $copy_to ]] || [[ $(diff "$copy_source" "$copy_to") ]]; then
|
|
262
|
+
cp -f "$copy_source" "$copy_to"
|
|
260
263
|
fi
|
|
261
264
|
}
|
|
262
265
|
|
|
@@ -265,12 +268,13 @@ git_clone_scripts() {
|
|
|
265
268
|
local dir="$2"
|
|
266
269
|
local branch="$3"
|
|
267
270
|
local proxy="$4"
|
|
268
|
-
|
|
271
|
+
local branch_args=()
|
|
272
|
+
[[ $branch ]] && branch_args=(-b "$branch")
|
|
269
273
|
t '开始拉取仓库 %s 到 %s\n' "${uniq_path}" "$dir"
|
|
270
274
|
|
|
271
275
|
set_proxy "$proxy"
|
|
272
276
|
|
|
273
|
-
git clone -q --depth=1 $
|
|
277
|
+
git clone -q --depth=1 "${branch_args[@]}" "$url" "$dir"
|
|
274
278
|
exit_status=$?
|
|
275
279
|
|
|
276
280
|
unset_proxy
|
|
@@ -283,15 +287,27 @@ random_range() {
|
|
|
283
287
|
}
|
|
284
288
|
|
|
285
289
|
delete_pm2() {
|
|
286
|
-
cd $dir_root
|
|
290
|
+
cd "$dir_root" || return $?
|
|
287
291
|
# Try to delete PM2 processes, but don't fail if PM2 is not available
|
|
288
292
|
pm2 delete ecosystem.config.js 2>/dev/null || true
|
|
289
293
|
# Also try to kill any directly spawned node processes
|
|
290
294
|
pkill -f "node.*static/build/app.js" 2>/dev/null || true
|
|
291
295
|
}
|
|
292
296
|
|
|
297
|
+
load_node_runtime_args() {
|
|
298
|
+
ql_node_runtime_args=()
|
|
299
|
+
local runtime_args
|
|
300
|
+
local helper="$dir_root/cli/src/internal/maintenance/nodeRuntime.cjs"
|
|
301
|
+
if [[ -f "$helper" ]]; then
|
|
302
|
+
runtime_args=$(node "$helper") || return $?
|
|
303
|
+
if [[ -n "$runtime_args" ]]; then
|
|
304
|
+
read -r -a ql_node_runtime_args <<<"$runtime_args"
|
|
305
|
+
fi
|
|
306
|
+
fi
|
|
307
|
+
}
|
|
308
|
+
|
|
293
309
|
reload_pm2() {
|
|
294
|
-
cd $dir_root
|
|
310
|
+
cd "$dir_root" || return $?
|
|
295
311
|
restore_env_vars
|
|
296
312
|
|
|
297
313
|
# Try to start PM2, but handle failures gracefully
|
|
@@ -301,6 +317,7 @@ reload_pm2() {
|
|
|
301
317
|
local exit_code=$?
|
|
302
318
|
t '警告: PM2 启动失败 (退出码: %s),可能是由于硬件不兼容' "$exit_code"
|
|
303
319
|
t '正在尝试直接使用 Node.js 启动服务...'
|
|
320
|
+
load_node_runtime_args || return $?
|
|
304
321
|
|
|
305
322
|
# Kill any existing node processes for qinglong
|
|
306
323
|
pkill -f "node.*static/build/app.js" 2>/dev/null || true
|
|
@@ -308,9 +325,9 @@ reload_pm2() {
|
|
|
308
325
|
# Start node directly in the background. In containers, keep application
|
|
309
326
|
# output on the container streams instead of duplicating Winston logs on disk.
|
|
310
327
|
if [[ "$QL_CONTAINER" == "true" ]]; then
|
|
311
|
-
nohup node static/build/app.js >/proc/1/fd/1 2>/proc/1/fd/2 &
|
|
328
|
+
nohup node "${ql_node_runtime_args[@]}" static/build/app.js >/proc/1/fd/1 2>/proc/1/fd/2 &
|
|
312
329
|
else
|
|
313
|
-
nohup node static/build/app.js
|
|
330
|
+
nohup node "${ql_node_runtime_args[@]}" static/build/app.js >"$dir_log/qinglong.log" 2>&1 &
|
|
314
331
|
fi
|
|
315
332
|
local node_pid=$!
|
|
316
333
|
|
|
@@ -391,14 +408,14 @@ handle_task_start() {
|
|
|
391
408
|
if [[ $ID ]]; then
|
|
392
409
|
local error=$(update_cron "\"$ID\"" "0" "$$" "$log_path" "$begin_timestamp")
|
|
393
410
|
if [[ $error ]]; then
|
|
394
|
-
error_message
|
|
411
|
+
error_message=$(t ', 任务状态更新失败(%s)' "$error")
|
|
395
412
|
fi
|
|
396
413
|
fi
|
|
397
414
|
t '## 开始执行... %s\n' "${begin_time}${error_message}"
|
|
398
415
|
}
|
|
399
416
|
|
|
400
417
|
run_task_before() {
|
|
401
|
-
. $file_task_before "$@"
|
|
418
|
+
. "$file_task_before" "$@"
|
|
402
419
|
|
|
403
420
|
if [[ ${task_before:=} ]]; then
|
|
404
421
|
t '执行前置命令\n'
|
|
@@ -408,7 +425,7 @@ run_task_before() {
|
|
|
408
425
|
}
|
|
409
426
|
|
|
410
427
|
run_task_after() {
|
|
411
|
-
. $file_task_after "$@"
|
|
428
|
+
. "$file_task_after" "$@"
|
|
412
429
|
|
|
413
430
|
if [[ ${task_after:=} ]]; then
|
|
414
431
|
t '\n执行后置命令\n'
|
|
@@ -433,7 +450,7 @@ handle_task_end() {
|
|
|
433
450
|
if [[ $ID ]]; then
|
|
434
451
|
local error=$(update_cron "\"$ID\"" "1" "$$" "$log_path" "$begin_timestamp" "$diff_time" "$exit_code")
|
|
435
452
|
if [[ $error ]]; then
|
|
436
|
-
error_message
|
|
453
|
+
error_message=$(t ', 状态更新失败(%s)' "$error")
|
|
437
454
|
fi
|
|
438
455
|
fi
|
|
439
456
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
: "${QL_DIR:?Please set QL_DIR}"
|
|
5
|
+
: "${QL_DATA_DIR:?Please set QL_DATA_DIR}"
|
|
6
|
+
[[ "$QL_DIR" = /* && "$QL_DATA_DIR" = /*/data ]] || { echo "QL_DIR and QL_DATA_DIR must be absolute paths (data directory ends in /data)" >&2; exit 1; }
|
|
7
|
+
command="$1"
|
|
8
|
+
|
|
9
|
+
export PNPM_HOME="${PNPM_HOME:-${QL_DATA_DIR}/dep_cache/node}"
|
|
10
|
+
if [[ -n "${PYTHON_VENV_DIR:-}" ]]; then
|
|
11
|
+
[[ "$PYTHON_VENV_DIR" = /* ]] || PYTHON_VENV_DIR="${QL_DIR}/${PYTHON_VENV_DIR}"
|
|
12
|
+
export PYTHON_VENV_DIR
|
|
13
|
+
if [[ ! -x "$PYTHON_VENV_DIR/bin/python3" ]]; then
|
|
14
|
+
python3 -m venv "$PYTHON_VENV_DIR"
|
|
15
|
+
fi
|
|
16
|
+
[[ -x "$PYTHON_VENV_DIR/bin/python3" ]] || { echo "Invalid Python venv" >&2; exit 1; }
|
|
17
|
+
unset PYTHON_HOME PYTHONUSERBASE PYTHONPATH
|
|
18
|
+
export PATH="${PYTHON_VENV_DIR}/bin:${PATH}:${PNPM_HOME}"
|
|
19
|
+
export PIP_CACHE_DIR="${PYTHON_VENV_DIR}/pip"
|
|
20
|
+
else
|
|
21
|
+
export PYTHON_SHORT_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
|
|
22
|
+
export PYTHON_HOME="${PYTHON_HOME:-${QL_DATA_DIR}/dep_cache/python3}"
|
|
23
|
+
export PYTHONUSERBASE="$PYTHON_HOME"
|
|
24
|
+
export PATH="${PATH}:${PNPM_HOME}:${PYTHON_HOME}/bin"
|
|
25
|
+
export PIP_CACHE_DIR="${PYTHON_HOME}/pip"
|
|
26
|
+
export PYTHONPATH="${PYTHON_HOME}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}/site-packages"
|
|
27
|
+
fi
|
|
28
|
+
export NODE_PATH="${NODE_PATH:-/usr/local/bin:/usr/local/lib/node_modules:${PNPM_HOME}/global/5/node_modules}"
|
|
29
|
+
mkdir -p "$PIP_CACHE_DIR"
|
|
30
|
+
|
|
31
|
+
cd "${QL_DIR}"
|
|
32
|
+
if [[ ! -e .env ]]; then
|
|
33
|
+
# Preserve user configuration, including a file created concurrently.
|
|
34
|
+
(umask 077; set -C; cat .env.example > .env)
|
|
35
|
+
fi
|
|
36
|
+
chmod u+x "${QL_DIR}"/shell/*.sh
|
|
37
|
+
|
|
38
|
+
. "${QL_DIR}/shell/share.sh"
|
|
39
|
+
. "${QL_DIR}/shell/env.sh"
|
|
40
|
+
|
|
41
|
+
log_with_style() {
|
|
42
|
+
local level="$1"
|
|
43
|
+
local message="$2"
|
|
44
|
+
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
|
45
|
+
|
|
46
|
+
printf "\n[%s] [%7s] %s\n" "${timestamp}" "${level}" "${message}"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
import_config "$@"
|
|
50
|
+
log_with_style "INFO" "$(t '🚀 1. 检测配置文件...')"
|
|
51
|
+
make_dir /etc/nginx/conf.d
|
|
52
|
+
make_dir /run/nginx
|
|
53
|
+
fix_config
|
|
54
|
+
|
|
55
|
+
# Slow devices may need more than the worker's readiness window to generate
|
|
56
|
+
# first-boot certificates. Reuse the regular initializer before starting workers.
|
|
57
|
+
load_node_runtime_args
|
|
58
|
+
node "${ql_node_runtime_args[@]}" <<'QL_PREPARE_GRPC_CERTS'
|
|
59
|
+
require(require('node:path').join(process.env.QL_DIR, 'static/build/config/grpcCerts.js'))
|
|
60
|
+
.initGrpcCerts()
|
|
61
|
+
.catch((error) => {
|
|
62
|
+
console.error(error);
|
|
63
|
+
process.exitCode = 1;
|
|
64
|
+
});
|
|
65
|
+
QL_PREPARE_GRPC_CERTS
|
|
66
|
+
|
|
67
|
+
pm2 l &>/dev/null || true
|
|
68
|
+
|
|
69
|
+
log_with_style "INFO" "$(t '🔄 2. 启动 nginx...')"
|
|
70
|
+
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
|
71
|
+
|
|
72
|
+
log_with_style "INFO" "$(t '⚙️ 3. 启动 pm2 服务...')"
|
|
73
|
+
reload_pm2
|
|
74
|
+
|
|
75
|
+
if [[ $command != "reload" ]]; then
|
|
76
|
+
if [[ $AutoStartBot == true ]]; then
|
|
77
|
+
log_with_style "INFO" "$(t '🤖 4. 启动 bot...')"
|
|
78
|
+
nohup ql bot >"$dir_log/bot.log" 2>&1 &
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
if [[ $EnableExtraShell == true ]]; then
|
|
82
|
+
log_with_style "INFO" "$(t '🛠️ 5. 执行自定义脚本...')"
|
|
83
|
+
nohup ql extra >"$dir_log/extra.log" 2>&1 &
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
pm2 startup
|
|
87
|
+
pm2 save
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
log_with_style "SUCCESS" "$(t '🎉 启动成功!')"
|
package/shell/start.sh
CHANGED
|
@@ -4,31 +4,56 @@
|
|
|
4
4
|
set -e
|
|
5
5
|
set -x
|
|
6
6
|
|
|
7
|
+
# Configuration and language helpers are not loaded during bootstrap errors.
|
|
8
|
+
startup_message() {
|
|
9
|
+
local format="$1"
|
|
10
|
+
shift
|
|
11
|
+
if [[ ${QL_LANG:-zh} == en ]]; then
|
|
12
|
+
case "$format" in
|
|
13
|
+
'未找到 qinglong 模块,请先执行 npm i -g @whyour/qinglong 安装') format='Module not found. Run: npm i -g @whyour/qinglong' ;;
|
|
14
|
+
'请先手动设置 export QL_DIR=%s,环境变量,并手动添加到系统环境变量,然后再次执行命令 qinglong 启动服务') format='Set export QL_DIR=%s in your system environment, then run qinglong to start the service' ;;
|
|
15
|
+
'QL_DIR 必须为绝对路径,例如 /ql') format='QL_DIR must be an absolute path, e.g. /ql' ;;
|
|
16
|
+
'请先手动设置数据存储目录 export QL_DATA_DIR 环境变量,目录必须以斜杠开头的绝对路径,并且以 /data 结尾,例如 /ql/data 并手动添加到系统环境变量') format='Set QL_DATA_DIR to an absolute path ending in /data, e.g. /ql/data, in your system environment' ;;
|
|
17
|
+
'QL_DATA_DIR 必须为以 /data 结尾的绝对路径,例如 /ql/data,如果有历史数据,请新建 data 目录,把历史数据放到 data 目录中') format='QL_DATA_DIR must be an absolute path ending in /data, e.g. /ql/data. Move existing data into that directory' ;;
|
|
18
|
+
'暂不支持此系统部署 %s') format='Unsupported system for deployment: %s' ;;
|
|
19
|
+
esac
|
|
20
|
+
fi
|
|
21
|
+
printf -- "$format\n" "$@" >&2
|
|
22
|
+
}
|
|
23
|
+
|
|
7
24
|
if [[ ! $QL_DIR ]]; then
|
|
8
|
-
npm_dir=$(npm root -g)
|
|
9
|
-
pnpm_dir
|
|
10
|
-
if
|
|
25
|
+
npm_dir=$(npm root -g 2>/dev/null) || npm_dir=""
|
|
26
|
+
pnpm_dir=""
|
|
27
|
+
if command -v pnpm >/dev/null 2>&1; then
|
|
28
|
+
pnpm_dir=$(pnpm root -g 2>/dev/null) || pnpm_dir=""
|
|
29
|
+
fi
|
|
30
|
+
if [[ -n "$npm_dir" && -d "$npm_dir/@whyour/qinglong" ]]; then
|
|
11
31
|
QL_DIR="$npm_dir/@whyour/qinglong"
|
|
12
|
-
elif [[ -d "$pnpm_dir/@whyour/qinglong" ]]; then
|
|
32
|
+
elif [[ -n "$pnpm_dir" && -d "$pnpm_dir/@whyour/qinglong" ]]; then
|
|
13
33
|
QL_DIR="$pnpm_dir/@whyour/qinglong"
|
|
14
34
|
else
|
|
15
|
-
|
|
35
|
+
startup_message '未找到 qinglong 模块,请先执行 npm i -g @whyour/qinglong 安装'
|
|
16
36
|
fi
|
|
17
37
|
|
|
18
38
|
if [[ $QL_DIR ]]; then
|
|
19
|
-
|
|
39
|
+
startup_message '请先手动设置 export QL_DIR=%s,环境变量,并手动添加到系统环境变量,然后再次执行命令 qinglong 启动服务' "$QL_DIR"
|
|
20
40
|
fi
|
|
21
41
|
|
|
22
42
|
exit 1
|
|
23
43
|
fi
|
|
24
44
|
|
|
45
|
+
if [[ $QL_DIR != /* ]]; then
|
|
46
|
+
startup_message 'QL_DIR 必须为绝对路径,例如 /ql'
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
25
50
|
if [[ ! $QL_DATA_DIR ]]; then
|
|
26
|
-
|
|
51
|
+
startup_message '请先手动设置数据存储目录 export QL_DATA_DIR 环境变量,目录必须以斜杠开头的绝对路径,并且以 /data 结尾,例如 /ql/data 并手动添加到系统环境变量'
|
|
27
52
|
exit 1
|
|
28
53
|
fi
|
|
29
54
|
|
|
30
|
-
if [[ $QL_DATA_DIR !=
|
|
31
|
-
|
|
55
|
+
if [[ $QL_DATA_DIR != /*/data ]]; then
|
|
56
|
+
startup_message 'QL_DATA_DIR 必须为以 /data 结尾的绝对路径,例如 /ql/data,如果有历史数据,请新建 data 目录,把历史数据放到 data 目录中'
|
|
32
57
|
exit 1
|
|
33
58
|
fi
|
|
34
59
|
|
|
@@ -38,7 +63,11 @@ if [[ $command != "reload" ]]; then
|
|
|
38
63
|
# 安装依赖
|
|
39
64
|
os_name="${QL_OS_TYPE:-}"
|
|
40
65
|
if [ -z "$os_name" ]; then
|
|
41
|
-
|
|
66
|
+
if [[ -r /etc/os-release ]]; then
|
|
67
|
+
os_name=$(source /etc/os-release && echo "$ID")
|
|
68
|
+
else
|
|
69
|
+
os_name=$(uname -s)
|
|
70
|
+
fi
|
|
42
71
|
fi
|
|
43
72
|
|
|
44
73
|
# 非 root 用户使用 sudo
|
|
@@ -69,7 +98,7 @@ if [[ $command != "reload" ]]; then
|
|
|
69
98
|
$SUDO apt-get install -y git curl wget tzdata perl openssl jq nginx procps netcat-openbsd openssh-client
|
|
70
99
|
;;
|
|
71
100
|
*)
|
|
72
|
-
|
|
101
|
+
startup_message '暂不支持此系统部署 %s' "$os_name"
|
|
73
102
|
exit 1
|
|
74
103
|
;;
|
|
75
104
|
esac
|
|
@@ -77,65 +106,13 @@ if [[ $command != "reload" ]]; then
|
|
|
77
106
|
npm install -g pnpm@8.3.1 pm2 ts-node typescript@5
|
|
78
107
|
fi
|
|
79
108
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
export PIP_CACHE_DIR=${PYTHON_HOME}/pip
|
|
88
|
-
export PYTHONPATH=${PYTHON_HOME}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}/site-packages
|
|
89
|
-
|
|
90
|
-
if [[ $command != "reload" ]]; then
|
|
91
|
-
pip3 install --prefix ${PYTHON_HOME} requests
|
|
92
|
-
fi
|
|
93
|
-
|
|
94
|
-
cd "${QL_DIR}"
|
|
95
|
-
if [[ ! -e .env ]]; then
|
|
96
|
-
# Preserve user configuration, including a file created concurrently.
|
|
97
|
-
(umask 077; set -C; cat .env.example > .env)
|
|
98
|
-
fi
|
|
99
|
-
chmod 777 ${QL_DIR}/shell/*.sh
|
|
100
|
-
|
|
101
|
-
. ${QL_DIR}/shell/share.sh
|
|
102
|
-
. ${QL_DIR}/shell/env.sh
|
|
103
|
-
|
|
104
|
-
log_with_style() {
|
|
105
|
-
local level="$1"
|
|
106
|
-
local message="$2"
|
|
107
|
-
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
|
108
|
-
|
|
109
|
-
printf "\n[%s] [%7s] %s\n" "${timestamp}" "${level}" "${message}"
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
log_with_style "INFO" "🚀 1. 检测配置文件..."
|
|
113
|
-
import_config "$@"
|
|
114
|
-
make_dir /etc/nginx/conf.d
|
|
115
|
-
make_dir /run/nginx
|
|
116
|
-
fix_config
|
|
117
|
-
|
|
118
|
-
pm2 l &>/dev/null
|
|
119
|
-
|
|
120
|
-
log_with_style "INFO" "🔄 2. 启动 nginx..."
|
|
121
|
-
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
|
122
|
-
|
|
123
|
-
log_with_style "INFO" "⚙️ 3. 启动 pm2 服务..."
|
|
124
|
-
reload_pm2
|
|
125
|
-
|
|
126
|
-
if [[ $command != "reload" ]]; then
|
|
127
|
-
if [[ $AutoStartBot == true ]]; then
|
|
128
|
-
log_with_style "INFO" "🤖 4. 启动 bot..."
|
|
129
|
-
nohup ql bot >$dir_log/bot.log 2>&1 &
|
|
130
|
-
fi
|
|
131
|
-
|
|
132
|
-
if [[ $EnableExtraShell == true ]]; then
|
|
133
|
-
log_with_style "INFO" "🛠️ 5. 执行自定义脚本..."
|
|
134
|
-
nohup ql extra >$dir_log/extra.log 2>&1 &
|
|
109
|
+
if [[ "$command" != "reload" ]]; then
|
|
110
|
+
if [[ -n "${PYTHON_VENV_DIR:-}" ]]; then
|
|
111
|
+
[[ "$PYTHON_VENV_DIR" = /* ]] || export PYTHON_VENV_DIR="${QL_DIR}/${PYTHON_VENV_DIR}"
|
|
112
|
+
[[ -x "$PYTHON_VENV_DIR/bin/python3" ]] || python3 -m venv "$PYTHON_VENV_DIR"
|
|
113
|
+
"$PYTHON_VENV_DIR/bin/python3" -m pip install requests
|
|
114
|
+
else
|
|
115
|
+
pip3 install --prefix "${PYTHON_HOME:-${QL_DATA_DIR}/dep_cache/python3}" requests
|
|
135
116
|
fi
|
|
136
|
-
|
|
137
|
-
pm2 startup
|
|
138
|
-
pm2 save
|
|
139
117
|
fi
|
|
140
|
-
|
|
141
|
-
log_with_style "SUCCESS" "🎉 启动成功!"
|
|
118
|
+
exec /bin/bash "${QL_DIR}/shell/start-simplify.sh" "$@"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Fork from the current Bash state: an external `bash -c` would lose private
|
|
4
|
+
# before-hook variables, arrays and functions used by sourced Shell scripts.
|
|
5
|
+
run_task_command() {
|
|
6
|
+
local timeout_seconds
|
|
7
|
+
if [[ -z ${command_timeout_time:-} ]]; then
|
|
8
|
+
"$@"
|
|
9
|
+
return $?
|
|
10
|
+
fi
|
|
11
|
+
timeout_seconds=$(awk -v value="$command_timeout_time" 'BEGIN {
|
|
12
|
+
if (value !~ /^([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[smhd]?$/) exit 1
|
|
13
|
+
unit = substr(value, length(value), 1)
|
|
14
|
+
factor = unit == "d" ? 86400 : unit == "h" ? 3600 : unit == "m" ? 60 : 1
|
|
15
|
+
printf "%.9f", (value + 0) * factor
|
|
16
|
+
}') || { printf 'Invalid task timeout: %s\n' "$command_timeout_time" >&2; return 125; }
|
|
17
|
+
if [[ $timeout_seconds == '0.000000000' ]]; then
|
|
18
|
+
"$@"
|
|
19
|
+
return $?
|
|
20
|
+
fi
|
|
21
|
+
(
|
|
22
|
+
timeout_dir=$(mktemp -d "${TMPDIR:-/tmp}/ql-task-timeout.XXXXXXXX") || exit 125
|
|
23
|
+
# Both children get private process groups. The timer and the wrapper must
|
|
24
|
+
# survive terminating the task, and descendants must not outlive a timeout.
|
|
25
|
+
set -m
|
|
26
|
+
( set +m; "$@" ) <&0 &
|
|
27
|
+
timeout_worker=$!
|
|
28
|
+
(
|
|
29
|
+
set +m
|
|
30
|
+
: > "$timeout_dir/ready"
|
|
31
|
+
sleep "$timeout_seconds" || exit 125
|
|
32
|
+
: > "$timeout_dir/expired"
|
|
33
|
+
kill -TERM -- "-$timeout_worker" 2>/dev/null || :
|
|
34
|
+
sleep 0.5
|
|
35
|
+
kill -KILL -- "-$timeout_worker" 2>/dev/null || :
|
|
36
|
+
) &
|
|
37
|
+
timeout_watcher=$!
|
|
38
|
+
set +m
|
|
39
|
+
finish_task_timeout() {
|
|
40
|
+
local code="$1"
|
|
41
|
+
trap - EXIT
|
|
42
|
+
{
|
|
43
|
+
# Bash can report a killed job between any two cleanup commands.
|
|
44
|
+
# Keep redirection active until the watchdog is fully reaped.
|
|
45
|
+
kill -KILL -- "-$timeout_watcher" || :
|
|
46
|
+
wait "$timeout_watcher" || :
|
|
47
|
+
} 2>/dev/null
|
|
48
|
+
if kill -TERM -- "-$timeout_worker" 2>/dev/null; then sleep 0.1; fi
|
|
49
|
+
kill -KILL -- "-$timeout_worker" 2>/dev/null || :
|
|
50
|
+
wait "$timeout_worker" 2>/dev/null || :
|
|
51
|
+
rm -rf -- "$timeout_dir"
|
|
52
|
+
exit "$code"
|
|
53
|
+
}
|
|
54
|
+
# Older Bash can omit a subshell's EXIT trap in sourced pipelines. Call
|
|
55
|
+
# cleanup explicitly on completion/signals, retaining EXIT as a fallback.
|
|
56
|
+
trap 'finish_task_timeout "$?"' EXIT
|
|
57
|
+
trap 'finish_task_timeout 130' INT
|
|
58
|
+
trap 'finish_task_timeout 143' TERM
|
|
59
|
+
trap 'finish_task_timeout 129' HUP
|
|
60
|
+
trap 'finish_task_timeout 131' QUIT
|
|
61
|
+
# Do not clean up a timer whose process group has not initialized yet.
|
|
62
|
+
while [[ ! -f "$timeout_dir/ready" ]]; do
|
|
63
|
+
kill -0 "$timeout_watcher" 2>/dev/null || finish_task_timeout 125
|
|
64
|
+
sleep 0.001
|
|
65
|
+
done
|
|
66
|
+
wait "$timeout_worker"
|
|
67
|
+
timeout_code=$?
|
|
68
|
+
if [[ -f "$timeout_dir/expired" ]]; then
|
|
69
|
+
# Let the timer finish escalation even if the task leader exited first.
|
|
70
|
+
wait "$timeout_watcher" 2>/dev/null || :
|
|
71
|
+
finish_task_timeout 124
|
|
72
|
+
fi
|
|
73
|
+
finish_task_timeout "$timeout_code"
|
|
74
|
+
)
|
|
75
|
+
}
|
package/shell/task.sh
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
3
|
dir_shell=$QL_DIR/shell
|
|
4
|
-
. $dir_shell/share.sh
|
|
5
|
-
. $dir_shell/api.sh
|
|
4
|
+
. "$dir_shell/share.sh"
|
|
5
|
+
. "$dir_shell/api.sh"
|
|
6
|
+
. "$dir_shell/task-timeout.sh"
|
|
6
7
|
|
|
7
8
|
trap 'single_hanle SIGINT' INT
|
|
8
9
|
trap 'single_hanle SIGTERM' TERM
|
|
@@ -18,6 +19,12 @@ single_hanle() {
|
|
|
18
19
|
exit 1
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
run_shell_script() {
|
|
23
|
+
# Preserve inherited variables/functions, but contain exit, exec and shell
|
|
24
|
+
# options so the task wrapper can run after hooks and report completion.
|
|
25
|
+
( . "$@" )
|
|
26
|
+
}
|
|
27
|
+
|
|
21
28
|
define_program() {
|
|
22
29
|
local file_param=$1
|
|
23
30
|
if [[ $file_param == *.js ]] || [[ $file_param == *.mjs ]]; then
|
|
@@ -25,7 +32,7 @@ define_program() {
|
|
|
25
32
|
elif [[ $file_param == *.py ]] || [[ $file_param == *.pyc ]]; then
|
|
26
33
|
which_program="python3"
|
|
27
34
|
elif [[ $file_param == *.sh ]]; then
|
|
28
|
-
which_program="
|
|
35
|
+
which_program="run_shell_script"
|
|
29
36
|
elif [[ $file_param == *.ts ]]; then
|
|
30
37
|
which_program="ts-node-transpile-only"
|
|
31
38
|
else
|
|
@@ -41,7 +48,7 @@ handle_log_path() {
|
|
|
41
48
|
fi
|
|
42
49
|
|
|
43
50
|
if [[ -z ${ID:=} ]]; then
|
|
44
|
-
ID=$(cat $list_crontab_user | grep -E "$cmd_task.* $file_param" | perl -pe "s|.*ID=(.*) $cmd_task.* $file_param\.*|\1|" | head -1 | awk -F " " '{print $1}')
|
|
51
|
+
ID=$(cat "$list_crontab_user" | grep -E "$cmd_task.* $file_param" | perl -pe "s|.*ID=(.*) $cmd_task.* $file_param\.*|\1|" | head -1 | awk -F " " '{print $1}')
|
|
45
52
|
fi
|
|
46
53
|
local suffix=""
|
|
47
54
|
if [[ ! -z $ID ]]; then
|
|
@@ -82,10 +89,10 @@ handle_log_path() {
|
|
|
82
89
|
log_path="$real_log_path"
|
|
83
90
|
fi
|
|
84
91
|
|
|
85
|
-
cmd
|
|
92
|
+
printf -v cmd '2>&1 | tee -a %q' "$dir_log/$log_path"
|
|
86
93
|
make_dir "$dir_log/$log_dir"
|
|
87
94
|
if [[ "${no_tee:=}" == "true" ]]; then
|
|
88
|
-
cmd
|
|
95
|
+
printf -v cmd '>> %q 2>&1' "$dir_log/$log_path"
|
|
89
96
|
fi
|
|
90
97
|
|
|
91
98
|
if [[ "${real_time:=}" == "true" ]]; then
|
|
@@ -106,11 +113,6 @@ format_params() {
|
|
|
106
113
|
mtime_format="%Y-%m-%d %H:%M:%S.%3N"
|
|
107
114
|
fi
|
|
108
115
|
timeoutCmd=""
|
|
109
|
-
if [[ $command_timeout_time ]]; then
|
|
110
|
-
if type timeout &>/dev/null; then
|
|
111
|
-
timeoutCmd="timeout --foreground -s 2 -k 10s $command_timeout_time "
|
|
112
|
-
fi
|
|
113
|
-
fi
|
|
114
116
|
# params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g')
|
|
115
117
|
|
|
116
118
|
# 分割 task 内置参数和脚本参数
|
|
@@ -160,5 +162,5 @@ define_program "${task_shell_params[@]}"
|
|
|
160
162
|
handle_log_path "${task_shell_params[@]}"
|
|
161
163
|
init_begin_time
|
|
162
164
|
|
|
163
|
-
eval . $dir_shell/otask.sh "$cmd"
|
|
165
|
+
eval '. "$dir_shell/otask.sh"' "$cmd"
|
|
164
166
|
exit 0
|