Skip to content

Instantly share code, notes, and snippets.

@abenson
Last active January 21, 2026 20:46
Show Gist options
  • Select an option

  • Save abenson/a691b9d137c9301dbc3397e54e990cd4 to your computer and use it in GitHub Desktop.

Select an option

Save abenson/a691b9d137c9301dbc3397e54e990cd4 to your computer and use it in GitHub Desktop.
Drive Trim Timer
#!/bin/sh
exec >> /var/log/fstrim.log
exec 2>&1
TIMEFILE=$(dirname $0)/fstrim.timer
printf "Beginning trim at $(date -u)...\n"
/usr/bin/fstrim -m 2M -a -v
printf "Trim completed at $(date -u)...\n"
touch $TIMEFILE
#!/bin/sh
TIMEFILE=$(dirname $0)/fstrim.timer
exec /usr/bin/snooze -w0 -s 7d -t $TIMEFILE $(dirname $0)/dotrim $TIMEFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment