[ubuntu-us-nm] Boot script run as root

Leif Gregory ldgregory69 at gmail.com
Fri Apr 11 21:34:21 BST 2008

Hello all,

My name is Leif and I guess I'll be the FNG till the next person subs.
I'm relatively new to Linux. Played off and on over the years with
Debian, Red Hat, Mandrake and a couple others pretty much in dual boot
environments. Shortly after installing Breezy Badger, I decided to make
the head on plunge and wiped Windows from all the home machines.
Haven't looked back since.

I'm a geek and love getting dirty tweaking things, but I still consider
myself a n00b in Linux.

So, to start the party off right, I figured I'd throw out a question
I've been unable to find an answer to.

To prevent my laptop hard drive from going to an early grave, I've been
using hdparm to set the Advance Power Management settings to 254 in
order to reduce the number of load/unload cycles.

i.e. hdparm -B 254 /dev/sda

hdparm requires su privileges and so I was doing this manually at
first. Sometimes I'd forget. So then I made a quicky script and threw
that into sessions with gksudo so when I log in, I get the password
prompt and it runs and all is good.

The downside is that one, it's annoying, and two, I have to log
in so that it runs. I'd like to set it up so that the script runs
during boot before login and does so with su privileges where I don't
have to type in a password for it.

I've googled all over and either I just am not getting the search terms
correct, or it's not something people do often enough to take the time
to write about.

I tried messing with sudoers so that my user account could run hdparm
without a password, but never could get it working. If I can't do the
boot thing, then I'll go back to that and see if you all can help.

Any ideas? Appreciate the help.

Leif Gregory
Power Wagon Registry:  http://powerwagonregistry.org
Truck Hacks:                http://trucks.PCWize.com
Geocaching:                    http://gps.PCWize.com
PHP Tutorials and snippets:    http://www.DevTek.org

More information about the ubuntu-us-nm mailing list