I want to run a command or script as root while booting, like just before login. I have tried the solution i used until 17.10, but after a fresh install of 18.04, I no longer have an /etc/rc.local. The command is hdparm -y /dev/sdc to put that drive into sleep, but it only works with root.

Thanks for any help.


You can just create the file /etc/rc.local and make it executable, then put this in it:

hdparm -y /dev/sdc
| improve this answer | |
  • Ok, I'll try it later. – Dragon8oy May 4 '18 at 7:20
  • @Dragon8oy so did it work? You could examine the status of systemd rc.local.service by systemctl status rc-local.service. – jarno Aug 27 '19 at 7:44
  • I think it worked, I don't have that install anymore and removed the drive I was powering down since then. – Dragon8oy Aug 27 '19 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.