mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-30 11:56:31 -05:00
Move tiered cache mover scripts to files in tools dir
This commit is contained in:
parent
2dd4b788ce
commit
9fcaf6a674
3 changed files with 36 additions and 40 deletions
21
tools/mergerfs.percent-full-mover
Executable file
21
tools/mergerfs.percent-full-mover
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
if [ $# != 3 ]; then
|
||||
echo "usage: $0 <cache-fs> <backing-pool> <percentage>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CACHE="${1}"
|
||||
BACKING="${2}"
|
||||
PERCENTAGE=${3}
|
||||
|
||||
set -o errexit
|
||||
while [ $(df --output=pcent "${CACHE}" | grep -v Use | cut -d'%' -f1) -gt ${PERCENTAGE} ]
|
||||
do
|
||||
FILE=$(find "${CACHE}" -type f -printf '%A@ %P\n' | \
|
||||
sort | \
|
||||
head -n 1 | \
|
||||
cut -d' ' -f2-)
|
||||
test -n "${FILE}"
|
||||
rsync -axqHAXWESR --preallocate --remove-source-files "${CACHE}/./${FILE}" "${BACKING}/"
|
||||
done
|
||||
13
tools/mergerfs.time-based-mover
Executable file
13
tools/mergerfs.time-based-mover
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
if [ $# != 3 ]; then
|
||||
echo "usage: $0 <cache-fs> <backing-pool> <days-old>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CACHE="${1}"
|
||||
BACKING="${2}"
|
||||
N=${3}
|
||||
|
||||
find "${CACHE}" -type f -atime +${N} -printf '%P\n' | \
|
||||
rsync --files-from=- -axqHAXWES --preallocate --remove-source-files "${CACHE}/" "${BACKING}/"
|
||||
Loading…
Add table
Add a link
Reference in a new issue