Is there a MarkLogic built-in function to disable a group scheduled task?
Before I knew such function already exists, I created my own -
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)
Yes, admin:group-scheduled-task-set-enabled()
. Don't forget to apply config changes using admin:save-configuration()
.
HTH!