tools -> scripts

This commit is contained in:
2025-11-14 10:44:57 +08:00
parent 0493f18b18
commit c7449f4acb
70 changed files with 369 additions and 2 deletions

31
scripts/make-swapfile.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
set -exo pipefail
# https://www.linode.com/docs/guides/how-to-increase-swap-space-in-ubuntu/
# https://help.ubuntu.com/community/SwapFaq
sudo swapon --show
free -h
df -h
if [ -f /swapfile ]; then
set +x
echo "Already exists"
exit 1
fi;
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
free -h
df -h
sudo cp /etc/fstab /etc/fstab.bak
echo "/swapfile swap swap defaults 0 0" | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=50
echo "vm.swappiness=50" | sudo tee -a /etc/fstab
sudo swapon --show