[Unit] Description=Kernel Samepage Merging ConditionPathExists=/sys/kernel/mm/ksm ConditionVirtualization=no [Service] Type=oneshot RemainAfterExit=yes ExecStart=/bin/bash -c "echo 1 > /sys/kernel/mm/ksm/run" ExecStop=/bin/bash -c "echo 0 > /sys/kernel/mm/ksm/run" [Install] WantedBy=multi-user.target