kill $balance_pid &> /dev/null
wait $balance_pid &> /dev/null
# Wait for the balance operation to finish.
- while ps aux | grep "balance start" | grep -qv grep; do
+ while pgrep -f "btrfs balance start" > /dev/null; do
sleep 1
done
}
kill $scrub_pid &> /dev/null
wait $scrub_pid &> /dev/null
# Wait for the scrub operation to finish.
- while ps aux | grep "scrub start" | grep -qv grep; do
+ while pgrep -f "btrfs scrub start" > /dev/null; do
sleep 1
done
}
kill $defrag_pid &> /dev/null
wait $defrag_pid &> /dev/null
# Wait for the defrag operation to finish.
- while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do
+ while pgrep -f "btrfs filesystem defrag" > /dev/null; do
sleep 1
done
}
kill $remount_pid &> /dev/null
wait $remount_pid &> /dev/null
# Wait for the remount loop to finish.
- while ps aux | grep "mount.*${btrfs_mnt}" | grep -qv grep; do
+ while pgrep -f "mount.*${btrfs_mnt}" > /dev/null; do
sleep 1
done
}
kill $replace_pid &> /dev/null
wait $replace_pid &> /dev/null
# Wait for the replace operation to finish.
- while ps aux | grep "replace start" | grep -qv grep; do
+ while pgrep -f "btrfs replace start" > /dev/null; do
sleep 1
done
}