I have the following service:
[Unit]
Description=foo
[Service]
Type=oneshot
RemainAfterExit=true
ExecStop=/opt/script/bar.sh
[Install]
WantedBy=multi-user.target
And bar.sh
:
#!/bin/bash
echo 1 > /sys/bus/workqueue/devices/writeback/cpumask
cat /sys/bus/workqueue/devices/writeback/cpumask > /tmp/writeback
Then after I rebooted, cat /tmp/writeback
looks good:
000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
But /sys/bus/workqueue/devices/writeback/cpumask
got overwritten back to default:
ffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff
Thought?
maybe use ExecStart instead of ExecStop?