Created
September 19, 2014 08:09
-
-
Save anonymous/b93d9c73ea149f0fc35f to your computer and use it in GitHub Desktop.
Cron job to run fstrim
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/sh | |
# Script to do SSD trim operations | |
# Based on: http://askubuntu.com/questions/18903/how-to-enable-trim | |
if [ "$(cat /sys/class/power_supply/AC/online)" = "0" ] | |
then | |
# running off the battery: abort | |
exit 0 | |
fi | |
# all mount points of SSD drives: | |
SSD_MOUNT_POINTS='/ /boot /home' | |
for mount_point in $SSD_MOUNT_POINTS | |
do | |
fstrim $mount_point | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment