Update notes

This commit is contained in:
Tony Garnock-Jones 2021-09-02 16:52:11 +02:00
parent 0f8c4d15a6
commit cbaecd3f58
5 changed files with 135 additions and 0 deletions

View File

@ -7,3 +7,6 @@ DBus - https://www.freedesktop.org/wiki/Software/dbus/
ubus (openwrt) - https://oldwiki.archive.openwrt.org/doc/techref/ubus
- ACLs
plumber (plan9!) - http://man.cat-v.org/plan_9/4/plumber
- data format "plumb" http://man.cat-v.org/plan_9/6/plumb
- autostarts listeners on request

93
notes/control-commands.md Normal file
View File

@ -0,0 +1,93 @@
---
title: 'System control commands'
---
## systemctl
Commands generally accept patterns to select subsets of the set of all
units.
- list-units
- list-sockets
- list-timers
- is-active (predicate over units)
- is-failed
- status
- show
- cat (introspection on source files for units)
- help (this is interesting!)
- list-dependencies
- start
- stop
- reload ("please reload your configuration" - even though we are
mostly reactive, most services won't be, and sometimes config in
files exists etc)
- restart (stop (if running) and then start (unconditionally))
- try-restart (if running, stop and then start)
- reload-or-restart, try-reload-or-restart
- isolate (effectively set a new "supergoal", removing all others. nb `AllowIsolate` flag)
- kill
- clean (remove various cache/state/config/log data)
- freeze, thaw
- set-property (for us, change a config .pr file; no --runtime equivalent, though)
- reset-failed (resets the state variables of the supervisor)
- (several others)
Enable vs start.
Enable: `--system`, `--user`, `--runtime`, `--global`: various scopes for enabling a unit.
Container management.
Job management. (It has a job queue!)
Environment management for spawned services.
`daemon-reexec`, serializes state for an upgrade
System lifecycle: startup -> running -> (shutdown | (maintenance -?-> running))
At shutdown or sleep, "inhibitor locks" exist. The action can respect
or ignore these. Interactive shutdown/sleep requests default to
respecting; non-interactive, to ignoring.
`isolate` targets:
- default
- rescue
- emergency
- halt
- poweroff
- reboot
- suspend
- hibernate
- hybrid-sleep
- suspend-then-hibernate
`switch-root`
## Service unit configuration
https://www.freedesktop.org/software/systemd/man/systemd.service.html
Service templates: can take a single argument to become instantiated.
If a service unit config file doesn't exist, falls back to looking for
an init script and synthesizes a unit on the fly.
Default dependencies:
- requires sysinit.target
- starts after sysinit.target
- starts after basic.target
- conflicts with shutdown.target
- shuts down before shutdown.target (?)
"slice units"? Oh ok, hierarchical supervision... and configuration of
whole branches of the tree.
Service lifecycle:
- states: active, activating, deactivating, dead, inactive, starting, ... more?
Options:
- Type (it's complicated)

View File

@ -77,3 +77,15 @@ and each service is aware of what it needs at the moment it starts.
Services: are Syndicate programs that speak the protocol on stdio. To
run other things, a supervisor program will listen to Syndicate and
run a subprocess in an ad-hoc way.
# pid-1 concerns
PID-1 concerns:
- sessions https://man7.org/linux/man-pages/man2/setsid.2.html
- handling of SIGINT and SIGTERM is special
- (and how should SIGSTOP / SIGTSTP/SIGTTIN/SIGTTOU work?? there's
some detail here https://github.com/Yelp/dumb-init I don't
understand)
- the container case is different from the host case
- "pivoting" to shutdown mode
- reaping of orphaned processes

18
notes/logging.md Normal file
View File

@ -0,0 +1,18 @@
---
---
from `ioctl_tty(2)`:
Redirecting console output
TIOCCONS
Argument: void
Redirect output that would have gone to /dev/console or
/dev/tty0 to the given terminal. If that was a
pseudoterminal master, send it to the slave. In Linux
before version 2.6.10, anybody can do this as long as the
output was not redirected yet; since version 2.6.10, only
a process with the CAP_SYS_ADMIN capability may do this.
If output was redirected already, then EBUSY is returned,
but redirection can be stopped by using this ioctl with fd
pointing at /dev/console or /dev/tty0.

View File

@ -105,3 +105,12 @@ Logging in daemontools:
- stdout is piped to stdin of the logger program
runit - see https://docs.voidlinux.org/config/services/index.html
2021-08-24 I asked on IRC: "I have a question about Erlang history, I
wonder if any of the old timers are here. I want to know how and when
supervisor.erl began its life. Joe's HOPL paper mentions "BOS" as a
source of inspiration, but I want to know more..."
> 15:03:25 < okeuday> tonyg: OTP behaviors were attributed to Lennart
> Öhman (working at Sjöland & Thyselius Telecom AB) in the past, but
> there are likely more details involved