Skip to content

Commit

Permalink
systemd: improve systemd to stop containers vss on restart
Browse files Browse the repository at this point in the history
stop right away on restart

Signed-off-by: Yariv Rachmani <[email protected]>
Signed-off-by: Douglas Schilling Landgraf <[email protected]>
  • Loading branch information
dougsland committed Sep 17, 2024
1 parent 9fc8f70 commit 7195da5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion systemd/vss-dbus.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@ Description=VSS D-Bus Service
After=network.target

[Service]
# Starts the VSS D-Bus service inside a container
ExecStart=/usr/lib/vss-lib/dbus/container_dbus_service
Restart=no

# Stops only containers whose name matches the pattern "vss_container*"
# -q: Outputs only the container IDs
# --filter "name=vss_container": Filters containers whose name starts with "vss_container"
# -t0: Stops containers immediately without waiting for a graceful shutdown
ExecStop=/bin/bash -c 'sudo podman stop $(sudo podman ps -q --filter "name=vss_container") -t0'

# Automatically restart the service if it stops unexpectedly
Restart=yes

# Run the service as root
User=root

[Install]
# Ensures the service is started in multi-user mode
WantedBy=multi-user.target

0 comments on commit 7195da5

Please sign in to comment.