Merge pull request #7 from schnerring/master

Remove code duplication and dependencies; improve portability, readability and docs; add option parsing, dependency and sudo check
This commit is contained in:
Keith Nash
2020-09-09 00:39:03 -05:00
committed by GitHub
4 changed files with 353 additions and 241 deletions
+12
View File
@@ -0,0 +1,12 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
+21 -11
View File
@@ -1,8 +1,11 @@
# Shell script for burn-in and testing of drives # Shell script for burn-in and testing of drives
## Purpose ## Purpose
`disk-burnin.sh` is a POSIX-compliant shell script I wrote to simplify the process of burning-in disks. It is intended for use only on disks which do not contain data, such as new disks or disks which are being tested or re-purposed. I was inspired by the ["How To: Hard Drive Burn-In Testing"](https://forums.freenas.org/index.php?threads/how-to-hard-drive-burn-in-testing.21451/) thread on the FreeNAS forum and I want to give full props to the good folks who contributed to that thread. `disk-burnin.sh` is a POSIX-compliant shell script I wrote to simplify the process of burning-in disks. It is intended for use only on disks which do not contain data, such as new disks or disks which are being tested or re-purposed. I was inspired by the ["How To: Hard Drive Burn-In Testing"](https://forums.freenas.org/index.php?threads/how-to-hard-drive-burn-in-testing.21451/) thread on the FreeNAS forum and I want to give full props to the good folks who contributed to that thread.
## Warnings ## Warnings
Be warned that: Be warned that:
* This script runs the `badblocks` program in destructive mode, which erases any data on the disk. Therefore, please be careful! __Do not run this script on disks containing data you value!__ * This script runs the `badblocks` program in destructive mode, which erases any data on the disk. Therefore, please be careful! __Do not run this script on disks containing data you value!__
@@ -10,11 +13,12 @@ Be warned that:
* Must be run as 'root', so either log on using the root account or use the `sudo` command, for example: `sudo ./disk_burnin.sh sda` * Must be run as 'root', so either log on using the root account or use the `sudo` command, for example: `sudo ./disk_burnin.sh sda`
## Tests ## Tests
Performs these steps: Performs these steps:
1. Run SMART short test 1. Run SMART short test
1. Run `badblocks` 2. Run `badblocks`
1. Run SMART extended test 3. Run SMART extended test
The script calls `sleep` after starting each SMART test, using a duration based on the polling interval reported by the disk, after which it polls for test completion. The script calls `sleep` after starting each SMART test, using a duration based on the polling interval reported by the disk, after which it polls for test completion.
@@ -34,13 +38,15 @@ These indicate possible problems with the drive. You therefore may wish to abort
The script extracts the drive model and serial number and creates a log filename of the form `burnin-[model]_[serial number].log`. The script extracts the drive model and serial number and creates a log filename of the form `burnin-[model]_[serial number].log`.
## `badblocks` Options ## `badblocks` Options
`badblocks` is invoked with the following options: `badblocks` is invoked with the following options:
- `-b 4096` : Use a block size of 4096
- `-e 1` : Abort the test if an error is found (remove this option for full testing of drives) * `-b 4096` : Use a block size of 4096
- `-v` : Verbose mode * `-e 1` : Abort the test if an error is found (remove this option for full testing of drives)
- `-o` : Write list of bad blocks found (if any) to a file named `burnin-[model]_[serial number].bb` * `-v` : Verbose mode
- `-s` : Show progress * `-o` : Write list of bad blocks found (if any) to a file named `burnin-[model]_[serial number].bb`
- `-w` : Write-mode test, writes four patterns (0xaa, 0x55, 0x44, 0x00) on every disk block * `-s` : Show progress
* `-w` : Write-mode test, writes four patterns (0xaa, 0x55, 0x44, 0x00) on every disk block
The only required command-line argument is the device specifier, e.g.: The only required command-line argument is the device specifier, e.g.:
@@ -71,6 +77,7 @@ Also note that `badblocks` may issue the following warning under FreeBSD/FreeNAS
## Operating System Compatibility ## Operating System Compatibility
Tested under: Tested under:
* FreeNAS 9.10.2-U1 (FreeBSD 10.3-STABLE) * FreeNAS 9.10.2-U1 (FreeBSD 10.3-STABLE)
* FreeNAS 11.1-U7 (FreeBSD 11.1-STABLE) * FreeNAS 11.1-U7 (FreeBSD 11.1-STABLE)
* FreeNAS 11.2-U8 (FreeBSD 11.2-STABLE) * FreeNAS 11.2-U8 (FreeBSD 11.2-STABLE)
@@ -80,16 +87,19 @@ Tested under:
## Drive Models Tested ## Drive Models Tested
The script should run successfully on any SATA disk with SMART capabilities, which includes just about all modern drives. It has been tested on these particular devices: The script should run successfully on any SATA disk with SMART capabilities, which includes just about all modern drives. It has been tested on these particular devices:
* HGST Deskstar NAS, UltraStar, UltraStar He10, and UltraStar He12 models * HGST Deskstar NAS, UltraStar, UltraStar He10, and UltraStar He12 models
* Western Digital Gold, Black, and Re models * Western Digital Gold, Black, and Re models
## Prerequisites ## Prerequisites
Requires the smartmontools, available at https://www.smartmontools.org
Uses: `grep`, `pcregrep`, `awk`, `sed`, `tr`, `sleep`, `badblocks` Requires the smartmontools, available at [www.smartmontools.org](https://www.smartmontools.org)
Tested with the static analysis tool at https://www.shellcheck.net to insure that the code is POSIX-compliant and free of issues. Uses: `grep`, `awk`, `sed`, `sleep`, `badblocks`
Tested with the static analysis tool at [www.shellcheck.net](https://www.shellcheck.net) to insure that the code is POSIX-compliant and free of issues.
## Author ## Author
Written by Keith Nash, March 2017. Written by Keith Nash, March 2017.
Modified on 19 August 2020. Modified on 19 August 2020.
Regular → Executable
+276 -187
View File
@@ -68,7 +68,7 @@
# your needs. In 'dry runs' the script does not actually perform any # your needs. In 'dry runs' the script does not actually perform any
# SMART tests or invoke the sleep or badblocks programs. The script is # SMART tests or invoke the sleep or badblocks programs. The script is
# distributed with 'dry runs' enabled, so you will need to edit the # distributed with 'dry runs' enabled, so you will need to edit the
# Dry_Run variable below, setting it to 0, in order to actually perform # DRY_RUN variable below, setting it to 0, in order to actually perform
# tests on drives. # tests on drives.
# #
# Before using the script on FreeBSD systems (including FreeNAS) you must # Before using the script on FreeBSD systems (including FreeNAS) you must
@@ -91,7 +91,7 @@
# #
# Requires the smartmontools, available at https://www.smartmontools.org # Requires the smartmontools, available at https://www.smartmontools.org
# #
# Uses: grep, pcregrep, awk, sed, tr, sleep, badblocks # Uses: grep, awk, sed, sleep, badblocks
# #
# Written by Keith Nash, March 2017 # Written by Keith Nash, March 2017
# #
@@ -121,7 +121,7 @@
# surrounding the integer value in order to fetch it reliably. # surrounding the integer value in order to fetch it reliably.
# #
# KN, 19 Aug 2020 # KN, 19 Aug 2020
# Changed Dry_Run value so that dry runs are no longer the default setting. # Changed DRY_RUN value so that dry runs are no longer the default setting.
# Changed badblocks call to exit immediately on first error. # Changed badblocks call to exit immediately on first error.
# Set logging directoryto current working directory using pwd command. # Set logging directoryto current working directory using pwd command.
# Reduced default tests so that we run: # Reduced default tests so that we run:
@@ -129,242 +129,331 @@
# 2> badblocks # 2> badblocks
# 3> Extended SMART test # 3> Extended SMART test
# #
######################################################################## ################################################################################
if [ $# -ne 1 ]; then ################################################################################
echo "Error: not enough arguments!" # PRE-EXECUTION VALIDATION
echo "Usage is: $0 drive_device_specifier" ################################################################################
# Check required dependencies
readonly DEPENDENCIES="awk badblocks grep sed sleep"
for dependency in ${DEPENDENCIES}; do
if ! command -v "${dependency}" > /dev/null 2>&1 ; then
echo "Command '${dependency}' not found" >&2
exit 2
fi
done
# Check if running as root
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root" >&2
exit 2 exit 2
fi fi
Drive=$1 readonly USAGE=\
"$(basename "$0") -- program to burn-in disks
# Set Dry_Run to a non-zero value to test out the script without actually Usage:
# running any tests; leave it set to zero to burn-in disks. $(basename "$0") [-h] [-f] [-o <directory>] <disk>
Dry_Run=0 By default the program runs in dry mode and no data will be lost.
# Directory specifiers for log and badblocks data files. Leave off the Options:
# trailing slash if you specify a value. Default is the current working -h show help text
# directory. -f run in destructive, non-dry mode
ALL DATA ON THE DISK WILL BE LOST!
-o <directory> write log files to <directory>
default: $(pwd)
<disk> disk to burn-in: /dev/<disk>
e.g. specify 'sda' to burn-in '/dev/sda'"
Log_Dir=$(pwd) while getopts ':hfo:' option; do
BB_Dir=$(pwd) case "${option}" in
h) echo "${USAGE}"
exit
;;
f) DRY_RUN=0
;;
o) LOG_DIR="${OPTARG}"
;;
:) printf 'Missing argument for -%s\n' "${OPTARG}" >&2
echo "${USAGE}" >&2
exit 2
;;
\?) printf 'Illegal option: -%s\n' "${OPTARG}" >&2
echo "${USAGE}" >&2
exit 2
;;
esac
done
shift $(( OPTIND - 1 ))
# Alternative: if [ -z "$1" ]; then
#Log_Dir="." echo "Missing option: <disk>" >&2
#BB_Dir="." echo "${USAGE}" >&2
exit 2
########################################################################
#
# Prologue
#
########################################################################
# Obtain the disk model and serial number:
Disk_Model=$(smartctl -i /dev/"$Drive" | grep "Device Model" | awk '{print $3, $4, $5}' | sed -e 's/^[ \t]*//;s/[ \t]*$//' | sed -e 's/ /_/')
if [ -z "$Disk_Model" ]; then
Disk_Model=$(smartctl -i /dev/"$Drive" | grep "Model Family" | awk '{print $3, $4, $5}' | sed -e 's/^[ \t]*//;s/[ \t]*$//' | sed -e 's/ /_/')
fi fi
Serial_Number=$(smartctl -i /dev/"$Drive" | grep -i "Serial Number" | awk '{print $3}' | sed -e 's/ /_/') ################################################################################
# CONSTANTS
################################################################################
# Form the log and bad blocks data filenames: # Drive to burn-in
readonly DRIVE="$1"
Log_File="burnin-${Disk_Model}_${Serial_Number}.log" # Run in dry mode if -f wasn't provided
Log_File=$Log_Dir/$Log_File [ -z "${DRY_RUN}" ] && DRY_RUN=1
readonly DRY_RUN
BB_File="burnin-${Disk_Model}_${Serial_Number}.bb" # Set to working directory if -o <directory> wasn't provided
BB_File=$BB_Dir/$BB_File [ -z "${LOG_DIR}" ] && LOG_DIR="$(pwd)"
# Trim trailing slashes
LOG_DIR="$(printf '%s' "${LOG_DIR}" | awk '{gsub(/\/+$/, ""); printf $1}')"
readonly LOG_DIR
# Query the short and extended test duration, in minutes. Use the values to # System information
# calculate how long we should sleep after starting the SMART tests: readonly HOSTNAME="$(hostname)"
readonly OS_FLAVOR="$(uname)"
Short_Test_Minutes=$(smartctl -c /dev/"$Drive" | pcregrep -M "Short self-test routine.*\n.*recommended polling time:" | sed -e 's/)//;s/(//' | awk '{print $4}' | tr -d '\n') # SMART static information
#printf "Short_Test_Minutes=[%s]\n" ${Short_Test_Minutes} readonly SMART_INFO="$(smartctl --info "/dev/${DRIVE}")"
readonly SMART_CAPABILITIES="$(smartctl --capabilities "/dev/${DRIVE}")"
Extended_Test_Minutes=$(smartctl -c /dev/"$Drive" | pcregrep -M "Extended self-test routine.*\n.*recommended polling time:" | sed -e 's/)//;s/(//' | awk '{print $4}' | tr -d '\n') ##################################################
#printf "Extended_Test_Minutes=[%s]\n" ${Extended_Test_Minutes} # Get SMART information value.
# Globals:
Short_Test_Sleep=$((Short_Test_Minutes*60)) # SMART_INFO
Extended_Test_Sleep=$((Extended_Test_Minutes*60)) # Arguments:
# value identifier:
# Selftest polling timeout interval, in hours # !!! Only TWO WORD indentifiers are supported !!!
Poll_Timeout_Hours=4 # !!! Querying e.g. "ATA Version is" will fail !!!
# - Device Model
# Calculate the selftest polling timeout interval in seconds # - Model Family
Poll_Timeout=$((Poll_Timeout_Hours*60*60)) # - Serial Number
# Outputs:
# Polling sleep interval, in seconds: # Write value to stdout.
Poll_Interval=15 ##################################################
get_smart_info_value() {
######################################################################## # $1=$2=""; select all but first two columns
# # gsub(/^[ \t]+|[ \t]+$/, ""); replace leading and trailing whitespace
# Local functions # gsub(/ /, "_"); replace remaining spaces with underscores
# # printf $1 print result without newline at the end
######################################################################## printf '%s' "${SMART_INFO}" \
| grep "$1" \
echo_str() | awk '{$1=$2=""; gsub(/^[ \t]+|[ \t]+$/, ""); gsub(/ /, "_"); printf $1}'
{
echo "$1" | tee -a "$Log_File"
} }
push_header() ##################################################
{ # Get SMART recommended test duration, in minutes.
echo_str "+-----------------------------------------------------------------------------" # Globals:
# SMART_CAPABILITIES
# Arguments:
# test type:
# - Short
# - Extended
# - Conveyance
# Outputs:
# Write duration to stdout.
##################################################
get_smart_test_duration() {
# '/'"$1"' self-test routine/ match duration depending on test type arg
# getline; jump to next line
# gsub(/\(|\)/, ""); remove parantheses
# printf $4 print 4th column without newline at the end
printf '%s' "${SMART_CAPABILITIES}" \
| awk '/'"$1"' self-test routine/{getline; gsub(/\(|\)/, ""); printf $4}'
} }
# Get disk model
DISK_MODEL="$(get_smart_info_value "Device Model")"
[ -z "${DISK_MODEL}" ] && DISK_MODEL="$(get_smart_info_value "Model Family")"
readonly DISK_MODEL
# Get disk serial number
readonly SERIAL_NUMBER="$(get_smart_info_value "Serial Number")"
# The script initially sleeps for a duration after a test is started.
# Afterwards the completion status is repeatedly polled.
# SMART short test duration
readonly SHORT_TEST_MINUTES="$(get_smart_test_duration "Short")"
readonly SHORT_TEST_SECONDS="$(( SHORT_TEST_MINUTES * 60))"
# SMART extended test duration
readonly EXTENDED_TEST_MINUTES="$(get_smart_test_duration "Extended")"
readonly EXTENDED_TEST_SECONDS="$(( EXTENDED_TEST_MINUTES * 60 ))"
# Maximum duration the completion status is polled
readonly POLL_TIMEOUT_HOURS=4
readonly POLL_TIMEOUT_SECONDS="$(( POLL_TIMEOUT_HOURS * 60 * 60))"
# Sleep interval between completion status polls
readonly POLL_INTERVAL_SECONDS=15
# Form log file names
readonly LOG_FILE="${LOG_DIR}/burnin-${DISK_MODEL}_${SERIAL_NUMBER}.log"
readonly BB_File="${LOG_DIR}/burnin-${DISK_MODEL}_${SERIAL_NUMBER}.bb"
################################################################################
# FUNCTIONS
################################################################################
##################################################
# Log informational message.
# Globals:
# LOG_FILE
# Arguments:
# Message to log.
# Outputs:
# Write message to stdout and log file.
##################################################
log_info()
{
now="$(date +"%F %T %Z")"
printf "%s\n" "[${now}] $1" | tee -a "${LOG_FILE}"
}
##################################################
# Log emphasized header message.
# Arguments:
# Message to log.
##################################################
log_header()
{
log_info "+-----------------------------------------------------------------------------"
log_info "+ $1"
log_info "+-----------------------------------------------------------------------------"
}
##################################################
# Poll repeatedly whether SMART self-test has completed.
# Globals:
# DRIVE
# POLL_INTERVAL_SECONDS
# POLL_TIMEOUT_SECONDS
# Arguments:
# None
# Returns:
# 0 if success or failure.
# 1 if timeout threshold exceeded.
##################################################
poll_selftest_complete() poll_selftest_complete()
{ {
l_rv=1 l_poll_duration_seconds=0
l_status=0 while [ "${l_poll_duration_seconds}" -lt "${POLL_TIMEOUT_SECONDS}" ]; do
l_done=0 smartctl --all "/dev/${DRIVE}" | grep -i "The previous self-test routine completed" > /dev/null 2<&1
l_pollduration=0 l_status="$?"
if [ "${l_status}" -eq 0 ]; then
# Check SMART results for "The previous self-test routine completed" log_info "SMART self-test succeeded"
# Return 0 if the test has completed, 1 if we exceed our polling timeout interval return 0
while [ $l_done -eq 0 ];
do
smartctl -a /dev/"$Drive" | grep -i "The previous self-test routine completed" > /dev/null 2<&1
l_status=$?
if [ $l_status -eq 0 ]; then
echo_str "SMART self-test complete"
l_rv=0
l_done=1
else
# Check for failure
smartctl -a /dev/"$Drive" | grep -i "of the test failed." > /dev/null 2<&1
l_status=$?
if [ $l_status -eq 0 ]; then
echo_str "SMART self-test failed"
l_rv=0
l_done=1
else
if [ $l_pollduration -ge "${Poll_Timeout}" ]; then
echo_str "Timeout polling for SMART self-test status"
l_done=1
else
sleep ${Poll_Interval}
l_pollduration=$((l_pollduration+Poll_Interval))
fi
fi
fi fi
smartctl --all "/dev/${DRIVE}" | grep -i "of the test failed." > /dev/null 2<&1
l_status="$?"
if [ "${l_status}" -eq 0 ]; then
log_info "SMART self-test failed"
return 0
fi
sleep "${POLL_INTERVAL_SECONDS}"
l_poll_duration_seconds="$(( l_poll_duration_seconds + POLL_INTERVAL_SECONDS ))"
done done
log_info "SMART self-test timeout threshold exceeded"
return $l_rv return 1
} }
run_short_test() ##################################################
# Run SMART test and log results.
# Globals:
# DRIVE
# LOG_FILE
# Arguments:
# Test type:
# - short
# - long
# Test duration in seconds.
##################################################
run_smart_test()
{ {
push_header log_header "Run SMART $1 test"
echo_str "+ Run SMART short test on drive /dev/${Drive}: $(date)" if [ "${DRY_RUN}" -eq 0 ]; then
push_header smartctl --test="$1" "/dev/${DRIVE}"
if [ "${Dry_Run}" -eq 0 ]; then log_info "SMART $1 test started, awaiting completion for $2 seconds ..."
smartctl -t short /dev/"$Drive" sleep "$2"
echo_str "Short test started, sleeping ${Short_Test_Sleep} seconds until it finishes"
sleep ${Short_Test_Sleep}
poll_selftest_complete poll_selftest_complete
smartctl -l selftest /dev/"$Drive" | tee -a "$Log_File" smartctl --log=selftest "/dev/${DRIVE}" | tee -a "${LOG_FILE}"
else else
echo_str "Dry run: would start the SMART short test and sleep ${Short_Test_Sleep} seconds until the test finishes" log_info "Dry run: would start the SMART $1 test and sleep $2 seconds until the test finishes"
fi fi
echo_str "Finished SMART short test on drive /dev/${Drive}: $(date)" log_info "Finished SMART short test"
}
run_extended_test()
{
push_header
echo_str "+ Run SMART extended test on drive /dev/${Drive}: $(date)"
push_header
if [ "${Dry_Run}" -eq 0 ]; then
smartctl -t long /dev/"$Drive"
echo_str "Extended test started, sleeping ${Extended_Test_Sleep} seconds until it finishes"
sleep ${Extended_Test_Sleep}
poll_selftest_complete
smartctl -l selftest /dev/"$Drive" | tee -a "$Log_File"
else
echo_str "Dry run: would start the SMART extended test and sleep ${Extended_Test_Sleep} seconds until the test finishes"
fi
echo_str "Finished SMART extended test on drive /dev/${Drive}: $(date)"
} }
##################################################
# Run badblocks test.
# !!! ALL DATA ON THE DISK WILL BE LOST !!!
# Globals:
# BB_File
# DRIVE
# Arguments:
# None
##################################################
run_badblocks_test() run_badblocks_test()
{ {
push_header log_header "Running badblocks test"
echo_str "+ Run badblocks test on drive /dev/${Drive}: $(date)" if [ "${DRY_RUN}" -eq 0 ]; then
push_header badblocks -b 4096 -wsv -e 1 -o "${BB_File}" "/dev/${DRIVE}"
if [ "${Dry_Run}" -eq 0 ]; then
#
# This is the command which erases all data on the disk:
#
badblocks -b 4096 -wsv -e 1 -o "$BB_File" /dev/"$Drive"
else else
echo_str "Dry run: would run badblocks -b 4096 -wsv -e 1 -o ${BB_File} /dev/${Drive}" log_info "Dry run: would run badblocks -b 4096 -wsv -e 1 -o ${BB_File} /dev/${DRIVE}"
fi fi
echo_str "Finished badblocks test on drive /dev/${Drive}: $(date)" log_info "Finished badblocks test"
} }
######################################################################## ################################################################################
# # ACTIONS BEGINS HERE
# Action begins here ################################################################################
#
########################################################################
if [ -e "$Log_File" ]; then # Create log directory if it doesn't exist
rm "$Log_File" mkdir -p -- "${LOG_DIR}" || exit 2
if [ -e "${LOG_FILE}" ]; then
rm "${LOG_FILE}"
fi fi
push_header log_header "Started burn-in"
echo_str "+ Started burn-in of /dev/${Drive} : $(date)"
push_header
echo_str "Host: $(hostname)" log_info "Host: ${HOSTNAME}"
echo_str "Drive Model: ${Disk_Model}" log_info "OS Flavor: ${OS_FLAVOR}"
echo_str "Serial Number: ${Serial_Number}" log_info "Drive: /dev/${DRIVE}"
echo_str "Short test duration: ${Short_Test_Minutes} minutes" log_info "Drive Model: ${DISK_MODEL}"
echo_str "Short test sleep duration: ${Short_Test_Sleep} seconds" log_info "Serial Number: ${SERIAL_NUMBER}"
echo_str "Extended test duration: ${Extended_Test_Minutes} minutes" log_info "Short test duration: ${SHORT_TEST_MINUTES} minutes / ${SHORT_TEST_SECONDS} seconds"
echo_str "Extended test sleep duration: ${Extended_Test_Sleep} seconds" log_info "Extended test duration: ${EXTENDED_TEST_MINUTES} minutes / ${EXTENDED_TEST_SECONDS} seconds"
echo_str "Log file: ${Log_File}" log_info "Log file: ${LOG_FILE}"
echo_str "Bad blocks file: ${BB_File}" log_info "Bad blocks file: ${BB_File}"
# Run the test sequence: # Run the test sequence:
run_short_test run_smart_test "short" "${SHORT_TEST_SECONDS}"
#run_extended_test
run_badblocks_test run_badblocks_test
#run_short_test run_smart_test "long" "${EXTENDED_TEST_SECONDS}"
run_extended_test
# Emit full device information to log: # Emit full device information to log:
push_header log_header "SMART and non-SMART information"
echo_str "+ SMART information for drive /dev/${Drive}: $(date)" smartctl --xall --vendorattribute=7,hex48 "/dev/${DRIVE}" | tee -a "${LOG_FILE}"
push_header
smartctl -x -v 7,hex48 /dev/"$Drive" | tee -a "$Log_File"
push_header log_header "Finished burn-in"
echo_str "+ Finished burn-in of /dev/${Drive} : $(date)"
push_header
# Clean up the log file: # Clean up the log file:
osflavor=$(uname) if [ "${OS_FLAVOR}" = "Linux" ]; then
sed -i -e '/Copyright/d' "${LOG_FILE}"
if [ "${osflavor}" = "Linux" ]; then sed -i -e '/=== START OF READ/d' "${LOG_FILE}"
sed -i -e '/Copyright/d' "${Log_File}" sed -i -e '/SMART Attributes Data/d' "${LOG_FILE}"
sed -i -e '/=== START OF READ/d' "${Log_File}" sed -i -e '/Vendor Specific SMART/d' "${LOG_FILE}"
sed -i -e '/SMART Attributes Data/d' "${Log_File}" sed -i -e '/SMART Error Log Version/d' "${LOG_FILE}"
sed -i -e '/Vendor Specific SMART/d' "${Log_File}"
sed -i -e '/SMART Error Log Version/d' "${Log_File}"
fi fi
if [ "${osflavor}" = "FreeBSD" ]; then if [ "${OS_FLAVOR}" = "FreeBSD" ]; then
sed -i '' -e '/Copyright/d' "${Log_File}" sed -i '' -e '/Copyright/d' "${LOG_FILE}"
sed -i '' -e '/=== START OF READ/d' "${Log_File}" sed -i '' -e '/=== START OF READ/d' "${LOG_FILE}"
sed -i '' -e '/SMART Attributes Data/d' "${Log_File}" sed -i '' -e '/SMART Attributes Data/d' "${LOG_FILE}"
sed -i '' -e '/Vendor Specific SMART/d' "${Log_File}" sed -i '' -e '/Vendor Specific SMART/d' "${LOG_FILE}"
sed -i '' -e '/SMART Error Log Version/d' "${Log_File}" sed -i '' -e '/SMART Error Log Version/d' "${LOG_FILE}"
fi fi
+2 -1
View File
@@ -1,6 +1,7 @@
MIT License MIT License
Copyright (c) 2017 by Keith Nash Original work Copyright (c) 2017 by Keith Nash
Modified work Copyright (c) 2020 by Michael Schnerring
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal