Skip to content

Jobs

Menu: Development → Jobs
Deep link: /_Admin/development/jobs?SiteId={siteGuid}

Jobs run KScript / TypeScript on the Kooboo server on a schedule: configure one-time or recurring runs for sync, cache cleanup, batch notifications, etc. Task scripts run in the site's server-side script context with k.content, k.DB, k.mail, etc. (similar to Code in Development → Code, but triggered by the scheduler, not HTTP).

Permissions

View list and logs: job (view). Add task, edit, save, Run require job·edit; multi-select Delete requires job·delete.

Difference from module tasks and mail tasks

Development → JobsModule module.config taskMail migration, etc.
ConfigInline Monaco script on this pagetask in module packageOther built-in admin features
ScopeCurrent siteModule contextMail site
Script triggerk.site.runJob (see k.site.runJob)Module events

Scheduler runs automatically only after site is Published; when unpublished, only manual Run for debugging.

How to Open

  1. In Edit Menu, enable Development → Jobs.
  2. Open Development → Jobs in the left sidebar.
Jobs page: tabs and task list

Tabs

TabDescription
Task listAll SiteJob definitions; create, edit, manual run, delete
CompletedRecent successful runs (up to ~100)
FailedRecent failed runs

Logs are in central JobLog: task name, description, run time, return message or exception stack.

Task list

Toolbar

ButtonPermissionDescription
Add taskjob·editOpen task edit dialog (new)
Task list toolbar

List table

ColumnDescription
NameUnique task name; cannot rename in dialog after create
StatusRunning / Completed (one-time, already fired) / Enabled (active) / Disabled
Start timeFirst schedule reference (UTC storage, local display)
RepeatWhether recurring
IntervalWhen repeating: "Every N second/minute/hour/day/week/month"
Row EditOpen dialog to change script and schedule
Multi-select RunWith one row selected, toolbar Run executes once async
Multi-select Deletejob·delete
Task list table

Task edit dialog

FieldDescription
NameRequired on create, 1–50 chars, unique in site; disabled when editing
Start timeSchedule start; one-time runs once after this time when site is published
Enableactive: scheduler skips when off; can still Run manually
RepeatWhen on, loop by interval; when off, one-time
EveryWhen repeating: frequenceUnit (positive int) + unit (second / minute / hour / day / week / month)
Execution codeMonaco editor, KScript; saved to SiteJob.Code, not a reference to Development → Code entries

Save via Job/post: new writes full model; update refreshes code, schedule fields, sets finish to false so one-time tasks can schedule again (adjust start time or manual run to re-trigger).

Task edit dialog

Example script (default comment in dialog):

typescript
// const log = "Execute at " + new Date().toString()
// k.response.write(log)

At runtime JobService compiles and runs this as a long task; return value or output goes to log Message.

Scheduling behavior (server)

Kooboo admin JobService scans in-memory tasks every second:

TypeConditionBehavior
Recurringactive, past startTime, interval since last run elapsed, site published, not currently runningAuto run, update last run time
One-timePast startTime, not finish, site publishedSet finish true then run once

Manual run (list Run or k.site.runJob) does not require published; still async; log notes manual trigger.

Interval maps to RepeatFrequence: day, hour, minute, week (×7 days), month (×30 days), second.

Completed / Failed logs

Both tabs share columns:

ColumnDescription
Task namejobName
Descriptione.g. auto schedule, manual trigger username
Run time
MessageSuccess: script return; failure: exception
DetailsDialog with full message
Completed log tab

Typical workflow

  1. Add task, name, start time, execution code.
  2. Enable Repeat and interval for recurring; otherwise one-time.
  3. After save, Run once and check logs (Failed tab for stack).
  4. Ensure site published, wait for schedule, or call k.site.runJob('task name') from other Code.
  5. Edit to adjust logic; multi-select Delete when no longer needed.
DocDescription
k.site.runJobManual trigger from script
CodeReusable Code resources (task inline script is separate)
ModulesModule task and k.module
Operations · Operation logsSite object change history (not job execution logs)