# 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 HOST_DIR, like "srv/gitea/compose.yml" or # "nginx/sites-enabled"; 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 /host, with /srv of the host in srv/ and its nginx config # in nginx/, both 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 # Writes links/ and services/ from the nginx config and the directories in # /srv. Copy deploy/jobs/services.sh to jobs/ for it. It runs when the nginx # config changes and every hour for new services, and rebuilds the static # site right away. EXCLUDE lists /srv directories to leave out. [[job]] id = "services" path = "services.sh" every = "1h" on = ["start", "watch"] watch = ["nginx"] then = ["index"] env = { EXCLUDE = "lost+found" } # 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