fix(k3s): 修正磁盘调度 unit 启动命令

systemd 会展开 unit 命令中的百分号 specifier,导致原 oneshot 启动失败。改用 echo 写入调度器,并强制校验 unit 为 active;bash -n、ShellCheck、manual-release-test.sh 通过。
This commit is contained in:
2026-08-02 10:41:16 +08:00
parent e20688bbe2
commit 9a01fd4657
2 changed files with 5 additions and 2 deletions
@@ -55,8 +55,8 @@ Before=k3s.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'printf "%s\\n" mq-deadline > /sys/block/$device/queue/scheduler'
ExecStop=/bin/sh -c 'printf "%s\\n" none > /sys/block/$device/queue/scheduler'
ExecStart=/bin/sh -c 'echo mq-deadline > /sys/block/$device/queue/scheduler'
ExecStop=/bin/sh -c 'echo none > /sys/block/$device/queue/scheduler'
RemainAfterExit=yes
[Install]
@@ -65,7 +65,9 @@ EOF
chmod 0644 "$temporary"
install -o root -g root -m 0644 "$temporary" "$unit_path"
systemctl daemon-reload
systemctl reset-failed "$unit_name" >/dev/null 2>&1 || true
systemctl enable --now "$unit_name" >/dev/null
[[ $(systemctl is-active "$unit_name") == active ]]
[[ $(current_scheduler) == mq-deadline ]]
printf 'control_plane_io=APPLIED node=hongkong device=%s scheduler=mq-deadline restart=false\n' "$device"
;;