View Full Version : [ubuntu] Running a command at start up

August 12th, 2009, 04:54 PM
Hi all,
I've just reinstalled Ubuntu and I can't seem to find how to run a command from startup every time I boot up. I want to run the following command:

sudo hdparm -B255 /dev/sda

Could someone please tell me how to do this, I've completely forgotten:oops:

August 12th, 2009, 04:56 PM
System / Preferences / Startup applications

August 12th, 2009, 05:01 PM
There are a couple of options. The easiest is to go to System > Preferences > Sessions and adding the Startup Program (this application is called gnome-session-properties).
You could also add the command to /etc/rc.local, which runs at the end of the boot process.

August 12th, 2009, 05:03 PM
I think once I had issues running sudo commands, I hate to put them in a script and run the script at startup... Don't know if that still applies...

August 12th, 2009, 05:09 PM
Yes, you can't run sudo commands in System > Preferences > Startup Applications. If you add the command (without the sudo in front) to /etc/rc.local it should work though.

August 12th, 2009, 09:28 PM
Thanks Buuntu, that's exactly what I was after