Guide
Background jobs, tasks and schedules in Edith
Edith keeps a small background helper running so your tools can refresh data, watch folders and finish long tasks while the window is closed. You can watch and control that work in the app. From the terminal you can also hand it your own commands as durable tasks, schedule commands on an interval or a cron rule, and wrap long commands so their output is kept.
See background work in the app
- Open Settings > About.
- Next to Diagnostics, press Show diagnostics.
Diagnostics shows:
- The background helper. Whether it is running, how long it has been running, and a Restart button (or Start when it is stopped).
- Scheduled jobs, grouped by the tool they come from. Each job shows when it last ran. Press Run now to run a job instead of waiting for its schedule, or Stop while it runs.
- Recent tasks, such as downloads or commands run with
ed, with their progress and result. Press Stop to cancel one, or right-click it and choose Copy task ID. - Troubleshooting, with an Event timeline you can search or narrow with Failures only, and Copy command under Logs to copy a Terminal command that shows the last hour of Edith's logs.
Closing the window or pressing ⌘W never stops background work. To stop everything, choose Quit Edith (⌥⌘Q). If Edith is not set to open at login, background work only runs while Edith is open, and Diagnostics offers Open login items.
From the terminal
ed agent statused agent jobsed agent jobs --jsoned agent status shows the state of the background services: build, process id, uptime, memory, CPU share and the path of their store.
ed agent jobs shows each job's id, its phase, its trigger, its cadence and how many pages are watching it. Some jobs run with no window open, and some speed up while a page that shows them is open. Phases are idle, running, paused, off and failed: off means the extension that owns the job is turned off, and paused means a power policy or the battery setting is holding it.
Run or cancel a job by its id:
ed agent run usage.refreshed agent cancel usage.refreshrun queues the job and returns at once. cancel asks a running job to stop. Check ed agent jobs or ed agent events for the result.
Run a command as a durable task
ed agent tasks exec hands a command to Edith's task queue. Once accepted, the task keeps running even if you close the terminal that submitted it, and it shows up under Recent tasks in Diagnostics.
ed agent tasks exec --detach --json -- /bin/sh -c 'sleep 2; printf "finished\n"'ed agent tasks lsed agent tasks inspect <id>ed agent tasks cancel <id>- Put
--before an absolute path to the program. Everything after it belongs to that program. - Without
--detach,edwaits and exits with the command's exit code. With--detach, it returns the task id at once. --timeoutbounds the run in seconds. The default is 300.inspectreturns the task's state, its saved output and its result.cancelstops the task's process group. Cancelling does not undo what the command already did.
A task that was running when Edith restarted stays visible as interrupted.
Schedule a command
ed agent schedule runs a command on an interval or a cron rule, inside Edith, with no window and no terminal open. Schedules are saved, so they survive restarts, updates and reboots.
ed agent schedule add sync --every 15m -- /usr/bin/trueed agent schedule add nightly --cron "30 2 * * *" --timeout 3600 -- /usr/bin/trueed agent schedule lsed agent schedule run synced agent schedule disable nightlyed agent schedule enable nightlyed agent schedule rm sync--everytakes a number and a unit,s,m,hord, from 1 minute to 7 days.--crontakes a five-field expression in the Mac's local time zone: minute, hour, day of month, month, weekday. It accepts*, numbers, ranges, lists and steps. Names such asmonare not supported.--cwdsets the working directory. It defaults to the directory where you ranadd.--timeoutbounds each run, up to 7200 seconds. The default is 300.
Each run is an ordinary task, so follow it with ed agent tasks ls and ed agent tasks inspect <id>.
What Edith guarantees:
- A run missed while Edith was not running, or while the Mac slept through it, is skipped. The next run is planned from when Edith starts.
- A run is skipped while the previous run of the same schedule is still going, so slow commands never pile up.
- Edith keeps at most 64 schedules.
Read events and logs
In Settings > About > Show diagnostics, open Event timeline to see recent jobs and tasks: queued, started, cancel requested, finished. Events survive a restart. If the background helper gets stuck, press Restart at the top of Diagnostics. It restarts without restarting the app.
From the terminal:
ed agent eventsed agent logs --last 1hed agent restarted agent logs reads Edith's lines from the macOS unified log, so it works even when Edith is not running.
Keep the output of a long command with ed run
ed run wraps a command you choose, saves its output and exit status, and notifies you when it finishes:
ed run --label "Build" -- make builded run --no-notify -- sh -c 'make test 2>&1 | tail -n 50'The command runs in your current directory with your environment, and its output still appears in your terminal. ed run exits with the command's exit code. Use sh -c '...' for pipelines and redirects. Full-screen and interactive programs do not work under ed run, so run those directly.
Read saved results:
ed runs lsed runs show <id>ed runs open <id>ed runs remove <id>ed runs diagnoseClicking the notification opens that run's report. It never runs the command again. Edith keeps the newest 200 finished results for up to 30 days. Results are saved under ~/Library/Application Support/Edith/Data/terminal/run-inbox. The output can contain secrets, so remove results you no longer need.
Notifications come from the Terminal extension in the running Edith. If Edith is closed or Terminal is off, the result is still saved without a notification. Allow notifications in Settings > Permissions, or with ed permissions request notifications.
Related
ed agentreference, includingscheduleandtasks.ed runanded runsreference.- Troubleshooting.