Hello all,

I wrote a service /etc/systemd/system/disable-2nd-hdd.service. I have 2 HDD's where one of them doesn't need to work all the time. So I thought it'd be cool to shut it down after 30 minutes of inactivity (the disc isn't mounted when system starts):
/usr/bin/hdparm -S 241 /dev/sdb

Then I wrote a service:

[Unit]
Description=Disable sdb
Requires=local-fs.target
After=local-fs.target

[Service]
Type=oneshot
ExecStart=/usr/bin/hdparm -S 241 /dev/sdb

[Install]
WantedBy=multi-user.target

Which seems to work:

[root@linux mk]# systemctl status disable-2nd-hdd.service
● disable-2nd-hdd.service - Disable sdb
Loaded: loaded (/etc/systemd/system/disable-2nd-hdd.service; enabled)
Active: inactive (dead) since pon 2014-04-28 10:00:53 CEST; 21min ago
Main PID: 248 (code=exited, status=0/SUCCESS)

kwi 28 10:00:53 linux hdparm[248]: /dev/sdb:
kwi 28 10:00:53 linux hdparm[248]: setting standby to 241 (30 minutes)

But it doesn't work, like it had never happened, the disc is not spun down.

When I change the command to /usr/bin/hdparm -y /dev/sdb (spin down disc immediately), the disc is spun down while booting but is starts again right away.

When I manually start this service after system has already booted, it works as expected.

Kindly asking for some help.

--
Pozdrawiam / Greetings
Marcin Kocur █
Dane kontaktowe / Contact details: http://koci.net.pl/email

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to