adding personal scripts

This commit is contained in:
2025-05-20 09:15:41 -04:00
parent fd41d1f0aa
commit 428084e4ee
9 changed files with 272 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
### Trim Proxmox host volumes and all LXCs on node ###
# Run as weekly cron job
# !/bin/bash
# Script colors
green=`tput setaf 2`
reset=`tput sgr0`
# Path to FSTRIM
FSTRIM=/sbin/fstrim
# List of host volumes to trim separated by spaces
# eg TRIMVOLS="/mnt/a /mnt/b /mnt/c"
TRIMVOLS="/"
## Trim all LXC containers ##
echo "${green}LXC CONTAINERS${reset}"
for i in $(pct list | awk '/^[0-9]/ {print $1}'); do
echo "Trimming Container $i"
pct fstrim $i 2>&1 | logger -t "pct fstrim [$$]"
done
echo ""
## Trim host volumes ##
echo "${green}HOST VOLUMES${reset}"
for i in $TRIMVOLS; do
echo "Trimming $i"
$FSTRIM -v $i 2>&1 | logger -t "fstrim [$$]"
done