Eh nan , pas résolu :p. Ce serait trop simple ! 😉
J'ai bien édité en virant le 1, même si en exécutant le script avec le 1 dedans il arrêtait bien le moteur du disque dur mais que après boot (voir la suite).
cat hdparm.service
[Unit]
Description=hdparm sleep
[Service]
Type=oneshot
ExecStart=/usr/sbin/hdparm -Y /dev/sda
[Install]
WantedBy=multi-user.target
Au démarrage le script se lance ....
hdparm.service - hdparm sleep
Loaded: loaded (/etc/systemd/system/hdparm.service; enabled; vendor preset: d
Active: inactive (dead) since Tue 2017-06-20 19:13:45 CEST; 1min 56s ago
Process: 689 ExecStart=/usr/sbin/hdparm -Y /dev/sda (code=exited, status=0/SUC
Main PID: 689 (code=exited, status=0/SUCCESS)
juin 20 19:13:45 john systemd[1]: Starting hdparm sleep...
juin 20 19:13:45 john hdparm[689]: /dev/sda:
juin 20 19:13:45 john hdparm[689]: issuing sleep command
juin 20 19:13:45 john systemd[1]: Started hdparm sleep.
Mais rien ne change. Disque en idle, et il ne s'est pas arrêté entre temps...
sudo hdparm -C /dev/sda
/dev/sda:
drive state is: active/idle
Seule solution : sudo systemctl start hdparm.service
Ce qu'il relance ...
hdparm.service - hdparm sleep
Loaded: loaded (/etc/systemd/system/hdparm.service; enabled; vendor preset: d
Active: inactive (dead) since Tue 2017-06-20 19:18:11 CEST; 25s ago
Process: 2223 ExecStart=/usr/sbin/hdparm -Y /dev/sda (code=exited, status=0/SU
Main PID: 2223 (code=exited, status=0/SUCCESS)
juin 20 19:18:11 john systemd[1]: Starting hdparm sleep...
juin 20 19:18:11 john hdparm[2223]: /dev/sda:
juin 20 19:18:11 john hdparm[2223]: issuing sleep command
juin 20 19:18:11 john systemd[1]: Started hdparm sleep.
Et là magie :
sudo hdparm -C /dev/sda
/dev/sda:
drive state is: standby
J'ai l'impression, enfin théorie théorie... Que au moment du démarrage où il lance le hdparm, il ne veut rien comprendre alors que quand ça a booté ça marche...