Bash
如何使用 systemd 在啟動時設置 cpumask?
我有以下服務:
[Unit] Description=foo [Service] Type=oneshot RemainAfterExit=true ExecStop=/opt/script/bar.sh [Install] WantedBy=multi-user.target
並且
bar.sh
:#!/bin/bash echo 1 > /sys/bus/workqueue/devices/writeback/cpumask cat /sys/bus/workqueue/devices/writeback/cpumask > /tmp/writeback
然後我重新啟動後,
cat /tmp/writeback
看起來不錯:000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
但
/sys/bus/workqueue/devices/writeback/cpumask
被覆蓋回預設值:ffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff
想法?
也許使用 ExecStart 而不是 ExecStop?