LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 14.0, Slackware 14.1, Slackware-current
Posts: 306

Rep: Reputation: 33
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,639

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: 202

Rep: Reputation: 89
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.
 
1 members found this post helpful.
Old 04-18-2012, 02:54 PM   #4
bogzab
Member
 
Registered: Mar 2006
Location: Dyserth, Wales
Distribution: Slackware 14.0, Slackware 14.1, Slackware-current
Posts: 306

Original Poster
Rep: Reputation: 33
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: 202

Rep: Reputation: 89
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 14.0, Slackware 14.1, Slackware-current
Posts: 306

Original Poster
Rep: Reputation: 33
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:16 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration