Gaps Filled with Frog DNA …
Joachim Wiberg troglobit@gmail.com
May 10, 2021
task [S] /libexec/system/setup.sh -- Bootstrap system
service [2345] foo -args -- Foo service
service [2345] <pid/foo> bar -args -- Bar service
service [2345] <pid>bar> baz -args -- Baz service
tty [12345789] console
tty :1 [12345789] tty1
tty :2 [2345] tty2
tty :3 [2345] tty3
service [LVLS] <COND> log env:[-]/etc/default/daemon daemon ARGS -- Service daemon
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | `---------- Optional description
| | | | | | `------------------ Daemon arguments
| | | | | `------------------------- Path to daemon
| | | | `---------------------------------------------------- Optional env. file
| | | `-------------------------------------------------------- Redirect output to log
| | `--------------------------------------------------------------- Optional conditions
| `---------------------------------------------------------------------- Optional Runlevels
`------------------------------------------------------------------------------ Monitored application
job:id → name:idpre:script and post:script support for init and cleanup taskssulogin(9)/etc/network/interfacesFallback shell
→ use new tty option flags instead
Emergency shell
→ replaced with rescue mode (next slide)
HOOK_SVC_START and HOOK_SVC_LOSTnotty flag for board bringuprescue flag starts sulogin for security/etc/network/interfaces
service identity same as in .conf file: job:id → name:id
name:foo
:idgreatly improved output from
initctl status
initctl status fooimproved interaction with user defined conditions
new commands
usr/ conditionsinitctl [status] # Show status of all services (old)
initctl status foo # Show status of service foo
initctl show foo # show foo.conf
initctl edit [-c] foo # edit (optionally create) foo.conf
initctl touch foo # mark foo.conf as modified for reload
initctl cond [set,clear] bar # user conditions, static & one-shot
initctl ps # tree view of known services with arguments
initctl top # top like view of services (cgroups)
initctl cgroup # cgroup view of services (limits)
New tooling to inspect resources:
initctl ps
initctl top
initctl cgroupTree view with ps subcommand
root/
|-- init/
| `-- finit
|-- system/
| |-- ssh/
| | `-- dropbear
| `-- Quagga/
| |-- ospfd
| `-- zebra
`-- user/
|-- sh
`-- getty tty2finit.conf for defining/modifying groupsfinit.d/*.conf for per-service group assignmentAvailable for service stanzas
service pre:/path/to/script.sh foo -args -- Foo service
service post:/path/to/script.sh bar -args -- Bar serviceREADY state, conditions do the restSTOPPING state, for cleanup taskDefault timeout for scripts: 3 sec, customize with general kill delay
service post:/path/to/script.sh kill:9 baz -args -- Baz service/etc/default/foo or /etc/conf.d/fooAvailable for service stanzas
service env:/etc/default/foo foo -n $FOO_ARGS -- Foo service/etc/default/foo are tracked as dependency to foo serviceinitctl reloadExample:
$ cat /etc/default/foo
FOO_ARGS=”-args”Global configuration of groups, standard cgrops v2 kernel syntax in /etc/finit.conf or /etc/finit.d/*.conf files.
cgroup init cpu.weight 100
cgroup user cpu.weight 100
cgroup hej cpu.weight 100
cgroup system cpu.weight 9700
For an overview, use initctl cgroup
Per service selection of group, or for a set of tasks:
cgroup.hej:mem.max:12345
service [23] <pid/foo> bar -- Bar service
service [23] <pid/foo> baz -- Baz servicePer service tweaking of limits also possible:
service [23] <pid/foo> cgroup.hej:mem.max:12345 frob -- Frob serviceChanges to cgroup configuration changes take effect after initctl reload
Join the discussion on GitHub or
#troglobit on Liberachat if IRC is more your thing.