[systemd-devel] Q: Change a kernel setting
Tomasz Torcz
tomek at pipebreaker.pl
Fri Jul 29 09:01:02 UTC 2022
On Fri, Jul 29, 2022 at 08:45:51AM +0200, Ulrich Windl wrote:
> Hi!
>
> I wonder: What is the recommended way to do this with systemd?:
> ---
> Add the following command to a script executed on system boot, such as /etc/init.d/boot.local:
>
> # echo 0 > /sys/kernel/mm/ksm/run
> ---
> Do I have to write a unit for it, or is there some generic mechanism already?
You can use tmpfiles. In the manpage
(https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html)
there's a following example, which you can adapt:
# Modify sysfs but don't fail if we are in a container with a read-only /proc
w- /proc/sys/vm/swappiness - - - - 10
--
Tomasz Torcz “(…) today's high-end is tomorrow's embedded processor.”
tomek at pipebreaker.pl — Mitchell Blank on LKML
More information about the systemd-devel
mailing list