summaryrefslogtreecommitdiff
path: root/src/op_mode/show_raid.sh
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-07-21 04:53:03 +0700
committerGitHub <noreply@github.com>2018-07-21 04:53:03 +0700
commitb7d7af33789d5f98ec27f326668a6b16ff228678 (patch)
tree0ce2988b1ce9d970e8a34c6af45f5a78128cf70e /src/op_mode/show_raid.sh
parent34f4d01d447c300e9dce824f822eae4b9cdbd705 (diff)
parent0c8e4605f19e7caa6fb7ccb7009bb21bb9c6cdbc (diff)
downloadvyos-1x-b7d7af33789d5f98ec27f326668a6b16ff228678.tar.gz
vyos-1x-b7d7af33789d5f98ec27f326668a6b16ff228678.zip
Merge pull request #17 from runborg/current
T689: updated show host xml and fixed op_mode script names from last PR.
Diffstat (limited to 'src/op_mode/show_raid.sh')
-rwxr-xr-xsrc/op_mode/show_raid.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/op_mode/show_raid.sh b/src/op_mode/show_raid.sh
new file mode 100755
index 000000000..ba4174692
--- /dev/null
+++ b/src/op_mode/show_raid.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+raid_set_name=$1
+raid_sets=`cat /proc/partitions | grep md | awk '{ print $4 }'`
+valid_set=`echo $raid_sets | grep $raid_set_name`
+if [ -z $valid_set ]; then
+ echo "$raid_set_name is not a RAID set"
+else
+ if [ -r /dev/${raid_set_name} ]; then
+ # This should work without sudo because we have read
+ # access to the dev, but for some reason mdadm must be
+ # run as root in order to succeed.
+ sudo /sbin/mdadm --detail /dev/${raid_set_name}
+ else
+ echo "Must be administrator or root to display RAID status"
+ fi
+fi