Using base.module.sh, replaced basename and dirname

This commit is contained in:
m8in
2026-05-15 23:47:44 +02:00
parent 272ebbaf9d
commit 30279d1056
6 changed files with 84 additions and 11 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
# trim all mounted or at least root file systems which support it
# call this file with cron
function run(){
local _FSTRIM _MAJOR_VERSION _START
_MAJOR_VERSION="$(lsb_release -r | cut -f2 | cut -d'.' -f1)"
[ "${_MAJOR_VERSION:?"Missing MAJOR_VERSION"}" -ge "16" ] \
&& _FSTRIM="fstrim -v --all" \
|| _FSTRIM="fstrim -v /"
_START="${SECONDS}"
readonly _FSTRIM _MAJOR_VERSION _START
echo -e "$(date) - fstrim started: '$($_FSTRIM)' (duration: $(date -u -d @"$((${SECONDS} - $_START))" +'%-Hh %Mm %Ss'))"
}
run > /var/log/fstrim.log