Created
July 16, 2024 23:16
-
-
Save tvarohohlavy/99f932808c6b2a81000b2fb0b59d5b5a to your computer and use it in GitHub Desktop.
DeskPi Super6C | Raspberry Pi CM4 | Enable Memory Cgroup on all nodes over SSH
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
# Variables | |
USERNAME= | |
HOSTNAME_BASE=deskpi0 | |
DOMAIN= | |
# Execute on nodes | |
for ID in {1..6} | |
do | |
echo "=================== $HOSTNAME_BASE$ID.$DOMAIN ===================" | |
ssh -T $USERNAME@$HOSTNAME_BASE$ID.$DOMAIN << EOF | |
FILE=/boot/firmware/cmdline.txt | |
DO_REBOOT=false | |
for PHRASE in "cgroup_enable=memory" "cgroup_memory=1" | |
do | |
if ! grep -q \$PHRASE \$FILE; then | |
echo "\$(cat \$FILE) \$PHRASE" | sudo tee \$FILE 1>/dev/null | |
echo "'\$PHRASE' added to \$FILE" | |
DO_REBOOT=true | |
fi | |
done | |
# Reboot if needed | |
if \$DO_REBOOT; then | |
echo "Rebooting NOW..." | |
sudo reboot | |
fi | |
EOF | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment