File tree 1 file changed +4
-9
lines changed
1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 1
- #! /usr/ bin/env bash
1
+ #! /bin/sh
2
2
3
3
# https://www.smartmontools.org/wiki/FAQ#WhatiserrorrecoverycontrolERCandwhyitisimportanttoenableitfortheSATAdisksinRAID
4
4
@@ -21,26 +21,21 @@ writesetting=70
21
21
# 3. A smartctl-based function:
22
22
get_smart_drives ()
23
23
{
24
- local gs_smartdrives
25
- local gs_drives
26
- local gs_drive
27
- local gs_smart_flag
28
-
29
- gs_drives=$( /usr/local/sbin/smartctl --scan | grep " dev" | awk ' {print $1}' | sed -e ' s/\/dev\///' )
24
+ gs_drives=$( /usr/local/sbin/smartctl --scan | grep " dev" | awk ' {print $1}' | sed -e ' s/\/dev\///' | tr ' \n' ' ' )
30
25
31
26
gs_smartdrives=" "
32
27
33
28
for gs_drive in $gs_drives ; do
34
29
gs_smart_flag=$( /usr/local/sbin/smartctl -i /dev/" $gs_drive " | grep " SMART support is: Enabled" | awk ' {print $4}' )
35
- if [ " $gs_smart_flag " == " Enabled" ]; then
30
+ if [ " $gs_smart_flag " = " Enabled" ]; then
36
31
gs_smartdrives=$gs_smartdrives " " ${gs_drive}
37
32
fi
38
33
done
39
34
40
35
eval " $1 =\$ gs_smartdrives"
41
36
}
42
37
43
- declare drives
38
+ drives= " "
44
39
get_smart_drives drives
45
40
46
41
# end of method 3.
You can’t perform that action at this time.
0 commit comments