I want to make
"echo 1 > /sys/kernel/mm/ksm/run" persistent between boots. I know that I can edit
/etc/sysctl.conf to make
/proc filesystem changes persist, but this doesn't seem to work for
/sys. How would I make this change survive reboots?
Most distros have some sort of an rc.local script that you could use. Check your distro as names and path may vary. Normally expect to look under /etc.
Debian has the package
sysfsutils which has an init.d script that can apply settings to
/sys based on the configuration in
The init script has an @debian.org author, so I suspect that this is debian-specific and may not have made it to other non-Debian distributions. However, all the logic is contained in the init script, so you could quite easily grab that package, extract the script and use it on your system.
/etc/sysctl.conf is read by one of your init scripts. This is somewhat distribution-dependent; on Debian, it's
/etc/init.d/procps. Debian doesn't have anything like this for settings under
/sys in its default installation (there's the
sysfsutils package if you want it though). If your distribution doesn't either, write an init script of your own.
/etc/sysctl.conf doesn't make
/proc/sys persistent: if you set something in
/proc/sys, it isn't saved in