Created
August 8, 2021 11:16
-
-
Save atanasyanew/017e0d73005de50c82dab31806a4bb98 to your computer and use it in GitHub Desktop.
RPI disable swap and log2ram
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
#!/bin/bash | |
if [ $1 = "uninstallswap" ]; then | |
echo "Uninstalling swapfile..." | |
sudo dphys-swapfile swapoff | |
sudo dphys-swapfile uninstall | |
sudo update-rc.d dphys-swapfile remove | |
sudo systemctl disable dphys-swapfile | |
echo "Swap file has been removed" | |
elif [ $1 = "disableswap" ]; then | |
echo "Disabling swapfile..." | |
if [ $(grep -c swappiness /etc/sysctl.conf) -eq 0 ]; then | |
echo "vm.swappiness=0" | sudo tee -a /etc/sysctl.conf | |
echo "updated /etc/sysctl.conf with vm.swappiness=0" | |
else | |
sudo sed -i "/vm.swappiness/c\vm.swappiness=0" /etc/sysctl.conf | |
echo "vm.swappiness found in /etc/sysctl.conf update to 0" | |
fi | |
sudo sysctl vm.swappiness=0 | |
echo "set swappiness to 0 for immediate effect" | |
else | |
echo "Param not set, pass either 'uninstallswap' or 'disableswap'" | |
fi |
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
#!/bin/bash | |
if [ ! -d ~/log2ram ]; then | |
git clone https://github.com/azlux/log2ram.git ~/log2ram | |
chmod +x ~/log2ram/install.sh | |
pushd ~/log2ram | |
sudo ./install.sh | |
popd | |
else | |
echo "Log2RAM is already installed. You can reinstall by running: 'sudo ./install.sh' from ~/log2ram " | |
sleep 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment