Skip to content

Commit

Permalink
Run "rke2-killall.sh" before shutdown
Browse files Browse the repository at this point in the history
Create a service to run script `rke2-killall.sh` to stop all the
running containers.

Signed-off-by: John Liu <john.liu@suse.com>
  • Loading branch information
John Liu committed Apr 12, 2022
1 parent 6bfeb2d commit 1017d3c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Kill RKE2 Containers for clean unmount
DefaultDependencies=no
RefuseManualStart=yes
Before=reboot.target halt.target shutdown.target poweroff.target umount.target final.target

[Install]
RequiredBy=reboot.target halt.target shutdown.target poweroff.target umount.target final.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/local/bin/rke2-killall.sh
7 changes: 7 additions & 0 deletions package/harvester-os/files/system/oem/91_rke2-shutdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "Enable RKE2 shutdown service"
stages:
initramfs:
- name: "enable rke2-shutdown.service"
if: 'grep -q root=LABEL=COS_ACTIVE /proc/cmdline && [ -n "$(blkid -L COS_ACTIVE)" ]'
commands:
- systemctl enable rke2-shutdown.service

0 comments on commit 1017d3c

Please sign in to comment.