how to execute a command automatically after resuming from suspend to RAM?
I'm running Fedora 8 with the latest stable kernel on an HP dv2715nr laptop (AMD Turion64 X2, 2GB RAM, nVidia GeForce 7150M) and using KDE.
First, a little background. I have one of those laptops where some pretty aggressive settings are causing the hard-disk read-head to park repeatedly. The laptop is barely 6 months old and I'm already at 100000 parks (thank you smartctl). This is bad. :)
A temporary solution is to run:
# hdparm -B 254 /dev/sda
and the parking pretty much stops. Note: completely disabling APM with -B 255 doesn't stop the parking, but -B 254 is the least aggressive setting. Anyway, this solution is great and all, but I need to do it every time I reboot (which really isn't an issue since you can run it from rc.local). The problem is, how can I run this same command automatically when I resume from suspending to RAM? Is there a resume script somewhere that I can stick this command into?
Thanks for any help!
So I created the following script in /etc/pm/sleep.d and chmod-ed it to 755:
# A script to automatically reset the APM disk settings to least-aggressive after
# resuming from suspend to RAM. This prevents the disk read-head from rapidly parking...
case "$1" in
hdparm -B 254 /dev/sda
but I still get the rapidly-parking head after resuming. I modeled this script after some info I found on the web about restoring a display that goes black upon resuming. Anyone have any ideas? Pleeeeeeease?
EDIT: sorry about the badly-written code. How do you get one of those nice "Code:" boxes?
Sorry, I am unable to answer your main question, but as for the nice little CODE boxes!
Above the reply window (towards the right) there is an icon "#". If you highlight your code and then hit that button, then it's job done.
Alternatively (command line bods) type [ code ] YOUR CODE HERE [/ code ]
Even small wins can be counted as successes.
I don't really understand your script, particularly what you are sourcing. But what I can't get at all is how and where would the parameter get its value from? Is it really loaded with "thaw|resume"? Did you try to "echo $1"? Because if it is not "thaw|resume" you'll of course get the old behavior of the disk...
To be honest, I'm not sure about the script either...but like I said, I basically copied it from something I found online, where it was used (with Fedora 8, btw) to correct a blank screen upon resuming from suspend to RAM. I just substituted the hdparm command. I'm open to suggestions...
Yeah, well, why don't you try
|All times are GMT -5. The time now is 01:02 AM.|