Tim:
Have you tried putting your script into one of the power management script directories [1], so it gets run automatically?
Frank Murphy:
If script was put there would it need any ext .sh etc.., am thinking /etc/pm/config.d As here it not a resume just losing the setup after using kvm. (no coder here)
On my Fedora 7 laptop, I have a script in /etc/pm/sleep.d/ for re-applying some parameters to my hard drive after a wakeup. You could use it as a template, changing the (hdparm) command line to whatever commands you were using to fix your problem.
#!/bin/bash
case "$1" in
thaw|resume) /sbin/hdparm -B255 /dev/sda ;;
*) ;;
esac
exit $?
The file permissions are rwx-r-xr-x. Though I suspect it only needs to be executable by root, I haven't bothered testing.