mirror of
https://github.com/unraid/webgui.git
synced 2026-05-03 16:29:45 -05:00
fix 'btrfs check' running status not detected correctly
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# btrfs_check start <dev> <id> <options>
|
||||
# btrfs_check status <dev> <id>
|
||||
# btrfs_check cancel <dev>
|
||||
# btrfs_check cancel <dev> <id>
|
||||
|
||||
case "$1" in
|
||||
'start')
|
||||
@@ -13,9 +13,14 @@ case "$1" in
|
||||
else
|
||||
echo "Not available"
|
||||
fi;
|
||||
pgrep -f "/sbin/btrfs_check.*$2" >/dev/null
|
||||
# establish retval of this script: 0 running, 1 not running
|
||||
pgrep -f "/sbin/btrfs check .*$2" >/dev/null
|
||||
;;
|
||||
'cancel')
|
||||
pkill -f "/sbin/btrfs_check.*$2"
|
||||
while pgrep -f "/sbin/btrfs check .*$2" >/dev/null ; do
|
||||
sleep 1
|
||||
done
|
||||
echo "Cancelled" >> /var/lib/btrfs/check.status.$3
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
case "$1" in
|
||||
'start')
|
||||
# one might wonder: why exec the scrub command, passing -B and put in background, vs just
|
||||
# executing scrub without -B and without explicit background. It's because it handles case
|
||||
# executing scrub without -B and without explicit background? It's because it handles case
|
||||
# where user adds -B themselves as one of the options, which would hang webGui process until
|
||||
# scrub completes which would not be good. btrfs balance does not have this btw.
|
||||
# scrub completes, which would not be good. (btrfs balance does not have -B option btw)
|
||||
exec /sbin/btrfs scrub start -B $3 $2 &>/dev/null &
|
||||
;;
|
||||
'status')
|
||||
|
||||
Reference in New Issue
Block a user