Re: smartctl

Startseite

Nachricht beantworten
Autor: anne.guilde@free.fr
Datum:  
To: guilde
Betreff: Re: smartctl
Le 30/05/2018 à 18:10, nt.guilde@??? a écrit :
> a="$(smartctl -t short /dev/sda)"
> (( $? )) && { # smartctl returned error
>    echo ERROR : >&2
>    echo "$a" >&2
>    exit 1
> }

>


Pas tout compris

Je veux bien des commentaires de chaque ligne
a="$(smartctl -t short /dev/sda)"
=> cela lance la commande...

smartctl donne l'ordre à smartd d'exécuter le test du disque dur si j'ai
bien compris ce que Christian a dit.
Donc tester $? ne sert pas à grand chose sauf s'il a pu ou pas envoyé la
demande de vérification du disque à smartd


> end="$(echo "$a" | sed '/Test will complete after /!d; s///')"
> sleep $(( `date +%s -d "$end"` - `date +%s` + 60 ))


ok

le dernier test

-----
# ./test-BorgUSB-sda-debian-1
+ smartctl -t short /dev/sda
+ a=smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in
off-line mode".
Drive command "Execute SMART Short self-test routine immediately in
off-line mode" successful.
Testing has begun.
Please wait 2 minutes for test to complete.
Test will complete after Thu May 31 16:05:38 2018

Use smartctl -X to abort test.
+ 0
./test-BorgUSB-sda-debian-1: 6: ./test-BorgUSB-sda-debian-1: 0: not found
+ echo smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-6-amd64] (local
build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in
off-line mode".
Drive command "Execute SMART Short self-test routine immediately in
off-line mode" successful.
Testing has begun.
Please wait 2 minutes for test to complete.
Test will complete after Thu May 31 16:05:38 2018

Use smartctl -X to abort test.
+ sed /Test will complete after /!d; s///
+ end=Thu May 31 16:05:38 2018
+ date +%s -d Thu May 31 16:05:38 2018
+ date +%s
+ sleep 180
-----

J'ai l'impression que smartctl est lancé 2 fois.
Pour le sleep 180, pas tous compris comment il calcule 180

Anne