fix 'btrfs check' running status not detected correctly

This commit is contained in:
Tom Mortensen
2017-05-13 11:59:43 -07:00
parent 4e12451ece
commit fbabf92f62
2 changed files with 9 additions and 4 deletions
+7 -2
View File
@@ -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
+2 -2
View File
@@ -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')