Add jobs service with script execution, configuration support, and control interface.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
OverlordandClaude Bot committed 2026-10-13 15:04:21 +02:00
1 parent 1f6d41ab06
commit 0ad5b5f44f
27 files changed
+1108 -45

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
# Reference for config/jobs.toml. The jobs service creates that file on its
# first start with the system jobs, and adds system jobs it lacks on every
# start. Edits apply within a second, which restarts all schedules as if the
# services had just started.
#
# Each [[job]] needs exactly one of:
# builtin a job implemented in the backend: index, status, reap-orphans
# path a script in jobs/, run by the jobs service; it must be executable
#
# Options:
# id lowercase letters, digits and dashes; unique
# args list of arguments for the script
# every run at a fixed interval: "30s", "15m", "1h", "1d"; at least 1s
# cron run on a cron schedule in UTC: "0 4 * * *"
# on events: "start", "content-change" (builtin jobs only) and "watch"
# watch paths relative to /srv on the host; needs on = ["watch"]. A
# directory is watched with everything inside it. The job runs
# once things have been quiet for 2s.
# then jobs to trigger after a successful run, builtin ones included
# timeout run time after which the job is cancelled; default "5m"
# env table of extra environment variables
# enabled false switches the job off and logs a warning; default true
# parallel true lets runs overlap. By default a new trigger cancels the
# running run and starts the job over.
#
# Scripts run as the owner of the content directory with bash, coreutils, curl,
# git and jq available, and get these variables:
# JOB_ID the id of the job
# CONTENT_DIR the content directory, writable
# HOST_DIR /srv of the host, read only
#
# Cancelling sends SIGTERM to the script and everything it started, then
# SIGKILL after 5s. Processes a script leaves behind are killed when it exits.
#
# Manage jobs with jobctl inside the jobs container:
# docker exec security-command-jobs-1 jobctl list
# docker exec security-command-jobs-1 jobctl run services
# docker exec security-command-jobs-1 jobctl cancel services
# Describes the services next to this one in services/, whenever one of their
# compose files changes, and rebuilds the static site right away.
[[job]]
id = "services"
path = "services.sh"
on = ["start", "watch"]
watch = ["gitea/compose.yml", "nextcloud/compose.yml"]
then = ["index"]
# Mirrors a public repository into the content once a night.
[[job]]
id = "mirror"
path = "mirror.sh"
args = ["https://example.org/notes.git", "notes"]
cron = "0 4 * * *"
timeout = "10m"
env = { GIT_TERMINAL_PROMPT = "0" }
enabled = false