LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-17-2012, 02:55 PM   #1
bogzab
Member
 
Registered: Mar 2006
Location: Dyserth, Wales
Distribution: Slackware 13.37, Slackware 14.0
Posts: 260

Rep: Reputation: 31
How to Run a Script on wake up from Sleep state


I want to be able to run a short script (which turns of the touchpad on my Thinkpad laptop, leaving just the trackpoint device working). I have the script and it works fine, but I have to run it manually every time I bring the machine back from sleep because it seems to always come up with the touchpad on.

Is there a place where such a script file should go to be executed automagically on return from sleep?

(Usually I am putting the PC to sleep via the KDE "Leave" Menu and waking it up just by opening the lid)

Thanks
 
Old 04-17-2012, 04:18 PM   #2
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,457

Rep: Reputation: Disabled
You can put your scripts in /etc/pm/sleep.d. There are a lot of scripts in /usr/lib/pm-utils/sleep.d that you can look at to find out how to make your script run on resume.

Brian
 
Old 04-17-2012, 04:20 PM   #3
marrowsuck
Member
 
Registered: Sep 2006
Posts: 84

Rep: Reputation: 25
When the computer wakes up from hibernate or suspend all scripts in
/etc/pm/sleep.d are called in reversed order with the argument "thaw" or "resume".

Just put something like
Code:
#!/bin/sh
case "$1" in
    thaw|resume)
        yourscript.sh
        ;;
esac
in /etc/pm/sleep.d and you should be fine.

For more information see man pm-action.
 
Old 04-18-2012, 02:54 PM   #4
bogzab
Member
 
Registered: Mar 2006
Location: Dyserth, Wales
Distribution: Slackware 13.37, Slackware 14.0
Posts: 260

Original Poster
Rep: Reputation: 31
This solution is not working for me in this case. I think that it might be because the scripts in /etc/pm/sleep.d are run before the X session is back up and running. To execute my "touchpad-off" script I think the X session has to be active.

Perhaps what I need is a place to store scripts which will run on commencement of an X session?
 
Old 04-18-2012, 06:58 PM   #5
marrowsuck
Member
 
Registered: Sep 2006
Posts: 84

Rep: Reputation: 25
Prepend your wrapperscript in /etc/pm/sleep.d with a low number e.g. 01wrapperscript,
so that it's called at the end.

How did you disable your touchpad in the first place?
Maybe it would be more convenient to disabled it through X with a configfile in /etc/X11/xorg.conf.d.
If you're using the synapitcsdriver just copy /usr/share/X11/xorg.conf.d/50-synaptics.conf to
/etc/X11/xorg.conf.d and insert the line
Code:
Option "TouchpadOff" "1"
 
Old 04-19-2012, 04:00 PM   #6
bogzab
Member
 
Registered: Mar 2006
Location: Dyserth, Wales
Distribution: Slackware 13.37, Slackware 14.0
Posts: 260

Original Poster
Rep: Reputation: 31
Tried the low number pre-pend but no joy.
However the X11 config solution worked fine - many thanks for this. Should have been obvious to me in the first place.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Sleep and Wake scheduling lonesoac0 Linux - Software 0 02-05-2012 03:25 PM
.../sleep.d script not fully running at resume state Frank64 Linux - General 8 04-07-2010 09:03 AM
Change job state from SLEEP to RUN sun_sun Programming 1 11-24-2007 11:23 PM
how to wake up from S3 acpi sleep state? bluesmanu Linux - Laptop and Netbook 4 01-15-2006 03:22 PM
Run script on wake FC3 JelloPhreak Linux - Software 0 06-15-2005 05:12 PM


All times are GMT -5. The time now is 11:42 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration