18 lines
		
	
	
	
		
			306 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
	
		
			306 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
for result in "$(zpool list -H -o name,health tank)"
 | 
						|
do
 | 
						|
    name=$(cut -f1 <<< $result)
 | 
						|
    health=$(cut -f2 <<< $result)
 | 
						|
 | 
						|
    if [ "$health" != ONLINE ]
 | 
						|
    then
 | 
						|
        errors="$errors\"$name\" health is \"$health\"\n"
 | 
						|
    fi
 | 
						|
done
 | 
						|
 | 
						|
if [ "$errors" != "" ]
 | 
						|
then
 | 
						|
    echo $errors
 | 
						|
    exit 2
 | 
						|
fi
 |