PDA

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



Igniteflow
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:

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

WRDN
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.

bacardiandwatermelon
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...

Buuntu
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.

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