Can we do something like this in a script (preferably zsh):
smartctl -t long /dev/sda
smartctl -t long /dev/sdb
smartctl -t long /dev/sdc
[Wait however long smartctl needs]
smartctl -H /dev/sda
smartctl -H /dev/sdb
smartctl -H /dev/sdc很明显,我只是想把它自动化。
发布于 2017-08-08 12:38:40
有两种可能性。smartctl -c将列出该设备的功能,其中包括如下行
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 48) minutes.因此,您可以简单地阅读这些内容,并在所需的短时间或长时间内进行睡眠。
第二,当测试正在进行时,相同的-c选项将列出任何测试的当前状态,例如:
Offline data collection status: (0x03) Offline data collection activity
is in progress.
Self-test execution status: ( 247) Self-test routine in progress...
70% of test remaining.
Total time to complete Offline
data collection: ( 44) seconds.因此,您可以每隔几分钟轮询一次,等待剩下的时间返回到0,其他字段有它们的最终值:
Offline data collection status: (0x02) Offline data collection activity
was completed without error.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: ( 0) seconds.https://unix.stackexchange.com/questions/384603
复制相似问题