cc-containerd: stop managed containers earlier on shutdown

Keep the shutdown helper active during normal system operation and run the
managed container stop path from ExecStop when shutdown begins.

This makes the container stop happen before the general system teardown,
so network and CCCS are still available and reboot is less likely to
block waiting for late shutdown ordering.

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
Isaac Hermida 2026-04-21 13:11:17 +02:00
parent 6ad1a57317
commit 408a8bec60
1 changed files with 7 additions and 6 deletions

View File

@ -1,15 +1,16 @@
[Unit]
Description=Stop managed containers during system shutdown
DefaultDependencies=no
Before=cccsd.service shutdown.target reboot.target halt.target poweroff.target kexec.target
After=cc-containerd.service network.target cccsd.service
Before=shutdown.target
Conflicts=shutdown.target
[Service]
Type=oneshot
ExecStart=/usr/bin/cc-containerd --config-file /etc/cc-container-mng.conf --stop-managed-containers
ExecStart=/bin/true
ExecStop=/usr/bin/cc-containerd --config-file /etc/cc-container-mng.conf --stop-managed-containers
RemainAfterExit=yes
TimeoutStopSec=30
[Install]
WantedBy=reboot.target
WantedBy=halt.target
WantedBy=poweroff.target
WantedBy=kexec.target
WantedBy=multi-user.target