Files
webgui/plugins/dynamix/scripts/zfs_scrub
bergware 0cac63d65f DeviceInfo: add ZFS Clear button
Show Clear button instead of Scrub button when applicable
2023-03-17 11:27:08 +01:00

24 lines
518 B
Bash
Executable File

#!/bin/bash
# zfs_scrub start <pool>
# zfs_scrub clear <pool>
# zfs_scrub status <pool>
# zfs_scrub cancel <pool>
case "$1" in
'start')
exec /usr/sbin/zpool scrub $2 2>/dev/null
;;
'clear')
exec /usr/sbin/zpool clear $2 2>/dev/null
;;
'status')
# first output whatever the status is to stdout
/usr/sbin/zpool status -P $2
# establish retval of this script: 0 running, 1 not running
/usr/sbin/zpool status -P $2 | grep -q 'scrub in progress'
;;
'cancel')
/usr/sbin/zpool scrub -s $2 2>/dev/null
;;
esac