用于禁用计划任务的 MarkLogic 函数

MarkLogic function to disable Scheduled Task

是否有MarkLogic内置功能来禁用群组计划任务?

在我知道这样的功能已经存在之前,我创建了自己的 -

xquery version "1.0-ml";

import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";

import module namespace mem = "http://xqdev.com/in-mem-update" at "/MarkLogic/appservices/utils/in-mem-update.xqy";

let $config := admin:get-configuration()

let $existingConfig := admin:group-get-scheduled-tasks($config, admin:group-get-id($config, "Default"))/fn:root()

let $newConfig := element configuration { mem:node-replace($existingConfig//*:scheduled-task/*:task-enabled/text(), text{"false"})!mem:node-delete(./*:groups/@timestamp) }

return admin:save-configuration($newConfig)

是的,admin:group-scheduled-task-set-enabled(). Don't forget to apply config changes using admin:save-configuration()

HTH!