我有以下服务:
[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?