From 4b9202786d8dde9537f19b9fe96cf1365917bcc0 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Thu, 20 Jan 2022 17:07:45 +0100 Subject: [PATCH] More notes on process supervision --- notes/process-supervision.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/notes/process-supervision.md b/notes/process-supervision.md index 94f7651..e0e3c77 100644 --- a/notes/process-supervision.md +++ b/notes/process-supervision.md @@ -123,3 +123,25 @@ Restart policies and lifecycles: daemontools-encore and nosh both use Daemontools just always restarts `./run` (after pausing 1 second). s6 is similar, but runs `./finish` if it exists, before restarting. + +Mac OS X "Lion" (?) introduced "sudden termination" at the Cocoa level: apps can indicate they +are OK with quick shutdown via SIGKILL. There's an analogous `launchd` feature for sudden +termination of daemons and background Mac processes, though confusingly the docs also say that +SIGTERM is sent a few seconds before SIGKILL for daemons. + - https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/Lifecycle.html + - https://developer.apple.com/documentation/foundation/processinfo#1651129 + - The time delay between SIGTERM and SIGKILL can be controlled (defaults to 20s?): + - https://apple.stackexchange.com/a/361723 + +Oh this is cool! From : + +> ## Daemons and Agents +> +> launchd differentiates between agents and daemons. The main difference is that an agent is +> run on behalf of the logged in user while a daemon runs on behalf of the root user or any +> user you specify with the UserName key. + +We have a similar distinction: the "system layer" of supervision vs. programs supervised by +other portions and/or by inferior syndicate-server instances (like inferior DBus/systemd +instances). Maybe holding the *conceptual* distinction between agents and daemons is also +worthwhile!