Just wanted to make sure and ask if this is good enough.
set -e
echo "=== fstrim ==="
fstrim -av
echo "=== BTRFS scrub status before ==="
btrfs scrub status /
echo "=== BTRFS scrub start ==="
btrfs scrub start -B /
echo "=== BTRFS scrub status after ==="
btrfs scrub status /
echo "=== BTRFS balance (50%) ==="
btrfs balance start -dusage=50 /
echo "=== Done ==="```


If you load a distro that already has btrfs options, they will have maintenance scripts built in. You shouldn’t need to touch btrfs manually on those, other than setting if your snapshots are cleaned up by number, or by time