terminusd docs :: script actions
Ascending Order Priority Execution

Full control of shutdown actions, with critical failure gatekeeping.

terminusd uses Priority Group execution logic that executes the groups in ascending order. Actions that share the same priority share a single priority group, and all actions within it will be executed in parallel.

Individual actions marked as critical will abort the remaining groups if they fail.

Since systemd is still in a functional state by the time the actions are executed, you can build a shutdown flow that caters to your needs, including execution of systemctl commands and anything else.

[Custom Name]

  • command: executable path with optional arguments. Required.
  • priority: priority group. Default 1000.
  • user, group: optional credential drop before execution.
  • env: optional KEY=VALUE file loaded for process environment.
  • critical: if true and action fails, all remaining priority groups are skipped.
  • enabled: if false, action is ignored and not loaded into temrminusd.

Execution semantics

  • Priority 100 runs before 200.
  • Same priority runs in parallel.
  • Critical failure aborts remaining groups.
  • Daemon releases inhibitor afterward.

Example: Staged Maintenance Flow

The following example demonstrates a set of staged executions that send a notification to all users, logs their sessions out and disables further logins to the system (example-logout-users.sh), fails over HA resources, stops required services before installing updates and then triggers update installation.

All service stop actions in the example are within a shared priority group and will execute in parallel.

[notify]
command = /usr/libexec/terminusd/examples/example-shutdown-notify.sh
priority = 100

[logout_users]
command = /usr/libexec/terminusd/examples/example-logout-users.sh
priority = 200

[ha_failover]
command = /usr/local/bin/failover-ha-resources.sh --force --noconfirm
priority = 300
critical = true

[stop_vcs]
command = /bin/systemctl stop vcs.service
priority = 400
critical = true

[stop_llt]
command = /bin/systemctl stop llt.service
priority = 400
critical = true

[stop_gab]
command = /bin/systemctl stop gab.service
priority = 400
critical = true

[update]
command = /usr/libexec/terminusd/examples/example-package-updates.sh
priority = 500
critical = true

[cleanup]
command = /usr/local/sbin/post-update-cleanup.sh
priority = 600