From ff5740483610127e2a76bae31a8b353f37a1c775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 27 Feb 2020 13:33:19 +0100 Subject: [PATCH] Init smart.run.test.sh script --- smart.run.test.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 smart.run.test.sh diff --git a/smart.run.test.sh b/smart.run.test.sh new file mode 100755 index 0000000..ce73c2c --- /dev/null +++ b/smart.run.test.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# .. vim: foldmarker=[[[,]]]:foldmethod=marker + +# This script will try to run a smart test on all compatible devices. +# The test can be passed as first argument. + +# Vars [[[ +debug="0" + +## Colors [[[ +c_redb='\033[1;31m' +c_magentab='\033[1;35m' +c_reset='\033[0m' +## ]]] + +temp_dir=$(mktemp -d -t smart.run.test-XXXXXX.tmp) +smart_device_list="${temp_dir}/smart.device.list" + +# ]]] + +# Create files +true > "${smart_device_list}" + +# Get the list of all available devices +smartctl --scan >> "${smart_device_list}" + + +# Remove temp_dir if debug is disable +[ "${debug}" -eq "0" ] || rm -rf -- "${temp_dir}" + +exit 0