17 lines
524 B
Bash
Executable File
17 lines
524 B
Bash
Executable File
#!/bin/bash
|
|
|
|
uuid=3d3a0763-4dfe-41e6-93c1-8c791ec98176
|
|
fspath=/mnt
|
|
|
|
file="/sys/fs/bcachefs/$uuid/snapshot_delete_status"
|
|
|
|
while IFS= read -r line; do
|
|
if [[ "$line" =~ ^Progress:[[:space:]]([0-9]+)%.*,[[:space:]]done[[:space:]]([0-9]+)/([0-9]+) ]]; then
|
|
percent="${BASH_REMATCH[1]}"
|
|
done_nodes="${BASH_REMATCH[2]}"
|
|
total_nodes="${BASH_REMATCH[3]}"
|
|
|
|
echo "bcachefs_snapshot_delete_status,uuid=$uuid,fspath=$fspath percent=$percent,done=$done_nodes,total=$total_nodes"
|
|
fi
|
|
done < "$file"
|