只需要把上面的文件放在 /etc/systemd/system/ 目录下面
然后执行 systemctl enable --now just-eat-some-mem.service
就可以简单的在每次开机的时候增加额外的2G内存占用,如果临时需要大量内存,
希望释放占用也可以简单的执行 systemctl stop just-eat-some-mem.service
Created
February 1, 2023 05:57
-
-
Save hatsuyuki280/b8dd6285d205fd094630b84cbb178f44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Just eating some mem for keep Always Free Avalible | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/dd if=/dev/random bs=20M count=100 of=/dev/shm/Just-eating-some-mem.bin | |
RemainAfterExit=true | |
ExecStop=/usr/bin/rm /dev/shm/Just-eating-some-mem.bin | |
StandardOutput=journal | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment