Jump to content

Have commands run at startup / login? [solved]


Recommended Posts

Hi,

 

I'm running Mandriva 10.2 and I was wondering where you can put commands so that they are executed at startup or when you login?

 

For example I had to turn off dma support as one of my hard disks doesn't work with it.

 

Now if I want to watch a dvd I have to use

 

hdparm -d1 /dev/dvd

 

to enable dma for the dvd player, I have to do this after every reboot.

 

Where can I add the dparm -d1 /dev/dvd so that I don't have to manually do it all the time.?

 

[moved from Software by spinynorman]

Link to comment
Share on other sites

Generally speaking, /etc/rc.local.

 

However, in this case, there's a more elegant MDV solution. Assuming your DVD drive is /dev/hdc - if it's something else, edit the following appropriately - do this. As root:

 

cd /etc/sysconfig

cp harddisks harddiskhdc

nano harddiskhdc

 

(or use vim, emacs, whatever floats your boat). It should be fairly obvious what to do, the file is well-commented. Just uncomment the line for enabling DMA.

 

The files /etc/sysconfig/harddisk* are parsed by the initscripts on boot and used to generate hdparm commands. The settings in the file 'harddisks' will be applied to all hard disks (well, /dev/hd*). If you make a copy of the file named harddiskhda the settings will apply to hda only, a copy named harddiskhdc's settings will apply to hdc only, and so on.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...