Am Montag, dem 05.08.2024 um 15:27 +0000 schrieb Joel GUITTET:
> Hello
> Is there a way when using "machinectl poweroff <name>" to wait until the 
> container is effectively totally stopped ? So that the following command 
> after machinectl poweroff can be executed safely (in my case un-mounting the 
> rootfs, cleaning iptables rules etc etc).
> Thanks
> Joel

Hi Joel,

you can busy-loop here, if you don't define your dependencies via other
units. Something like

```bash
$MY_MACHINE='some_name'
machinectl poweroff "$MY_MACHINE"
while [[ "$(machinectl --property state --value show "$MY_MACHINE)" == 
"running" ]]; do
    sleep 1
done
umount "${MY_MACHINE}_rootfs"
remove_iptables
etc
```

BR
Silvio

Reply via email to