1

I'm using Fedora CoreOS with the automatic updater enabled, which is great for my use case. Already, when logged in interactively, the system warns about an imminent shutdown/restart via the console, with the same mechanisms described in the answers like Sending shutdown messages to all clients from server

However, the "actual" users of this server aren't Linux users with SSH access but access servers like an IRC or other services. I would like to "catch" the shutdown warning message and forward it to each of the services, s.t. they can broadcast it.

The services are orchestrated using unprivileged podman/docker containers ran through systemd (podman-generate-systemd) user units.

I can (ab)use the ExecStopPre setting in the systemd unit to always sleep 5m before shutting down the unit. This isn't precisely what I want, though, as I'd like to be able to restart/stop a service immediately, when done manually using systemctl --user stop/restart.

I currently see two paths that could enable this:

  1. some way for units to listen to wall messages and forward them
  2. some way of specifying --ignore ExecStopPre on the console.

The latter can be, albeit unergonomically, be achieved using systemctl --user edit --runtime. However, the second approach has the downtime of (ab)using ExecStopPre while it may be needed for other purposes already.

Nonetheless, I'd be glad for ideas on how to achieve (1) or to make (2) a bit more nice to work with. Or even completely different approaches to the problem.

ljrk
  • 111
  • 3
  • 1
    Maybe using `After=final.target` like in https://unix.stackexchange.com/a/479048 ? (Just a wild guess. I haven't used it myself) – Erik Sjölund Oct 14 '21 at 10:56
  • @ErikSjölund Thanks, I didn't know of this setting -- but if the system is already remounted as r/o the service wouldn't be able store the current state to the disk anymore, I think. – ljrk Oct 14 '21 at 15:33

0 Answers0