Scripts triggered by power/suspend changes are located in /etc/pm
They are triggered twice per change first time with "true" or "false" argument when power change is triggered and second time with "suspend suspend" or "suspend resume" when that change is finishing. That means when you do a full cycle suspend-resume they got triggered four times.
Simply put your script in /etc/pm and link in apropriate directory there and note what is happening.
Its useful to pause and resume mpd or when you dont want to use thick power agent (ie in text mode) to make suspend/resume or backlight change when button is pressed or lid closed/open.