Laptop waking up in bag: go back to sleep script


 
Thread Tools Search this Thread
Operating Systems Linux Debian Laptop waking up in bag: go back to sleep script
# 1  
Old 06-29-2008
Laptop waking up in bag: go back to sleep script

I have a Debian-derived distro (Kubuntu 8.04) running on a Dell Inspiron laptop. This laptop often wakes from RAM suspension while in my bag. I would like to run a script, upon RAM suspension wake, that would detect if the lid switch is closed. If so, then the script should put the machine back in RAM suspension. Something like this:
Code:
wait 5 seconds
if (lid==open) {
  go to ram suspension
}
return

I do not know how to poll the lid switch, nor do I know how to suspend to RAM from within a script. I have googled but cannot find this. Can someone point me to a RTFM where TFM shows how to do these two actions? Note that other than a short C course in university and a smithering of PHP I really know nothing about computers. I will ask on my distro's mailing list how to have the script run at wake. Thanks in advance.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Ubuntu

Laptop to laptop transfer files

Dear all, I would like to transfer my old laptop documents/files etc to the new laptop without using any external hard disk. Please let me know if its possible via any way. Thank in advance, emily (3 Replies)
Discussion started by: emily
3 Replies

2. IP Networking

waking up

can i shutdown or wake on call all the pc's connected in a network using tools? (3 Replies)
Discussion started by: yashwanthguru
3 Replies

3. Ubuntu

Connect 2 laptops with RJ45 cable (Ubuntu 10.10 laptop with Windows 7 laptop)

Hi to all, I have the problem that a laptops with windows XP cannot startup even in safe mode nor using last good known configuration. I have a Ubuntu 10.10 Live CD and booting from it I can read the Hard Drive. I need to do a backup the Hard Drive from XP laptop and I want to connect this... (5 Replies)
Discussion started by: cgkmal
5 Replies

4. Shell Programming and Scripting

Wrapping 'sleep' with my 'resleep' function (Resettable sleep)

This is a very crude attempt in Bash at something that I needed but didn't seem to find in the 'sleep' command. However, I would like to be able to do it without the need for the temp file. Please go easy on me if this is already possible in some other way: How many times have you used the... (5 Replies)
Discussion started by: deckard
5 Replies

5. Shell Programming and Scripting

Laptop/Desktop... Back up/Mirror script.

Hello all, I have a script I am trying to put together, what I am trying to do is mirror my home dir (excluding my music dir) between my desktop and laptop. My intention is to create a cron job to run two scripts, one to push the data to the laptop at the end of the day, and one to pull the data... (5 Replies)
Discussion started by: komputersman
5 Replies

6. Windows & DOS: Issues & Discussions

Waking up windowsXP from FC3

In my home network I have a windows XP server and a Redhat FC3 Linux server. The linux server has ssh open to the internet. What I'd like to do is ssh into the FC3 machine and "wakeup" the windows XP box which is in standby mode. Anyone know a way to achieve this? (1 Reply)
Discussion started by: dangral
1 Replies
Login or Register to Ask a Question
SLEEPD(8)						      System Manager's Manual							 SLEEPD(8)

NAME
sleepd - puts a laptop to sleep during inactivity or on low battery SYNOPSIS
sleepd [-s command] [-d command] [-u n] [-U n] [-I] [-i n] [-E] [-e filename] [-a] [-l n] [-w] [-n] [-v] [-c n] [-b n] [-A] [-H] [-N [device] [-r n] [-t n]] DESCRIPTION
sleepd is a daemon to force laptops to go to sleep after some period of inactivity. This is useful if your laptop does not automatically go to sleep when you aren't using it, and, like me, you often forget to shut it off. It is also capable of suspending a laptop when its bat- tery gets very low. sleepd can detect activity in several ways. The default is to poll both event devices and interrupts to detect when your laptop is in use due to keyboard or mouse activity. It defaults to polling /dev/input/event*. You may specify a list of device files to poll instead, or use options to enable other means of checking for activity (network activity, utmp, or load average). After a configurable amount of time with no activity, sleepd runs a program to put the laptop to sleep. OPTIONS
-h, --help Show summary of options. -n, --nodaemon Don't fork to background; run in forground. -v, --verbose Output status messages. -u, --unused Number of seconds the laptop can remain idle before being put to sleep. Defaults to 600 seconds (10 minutes). Set to 0 to disable any sleeping due to idleness. -U, --ac-unused If set, controls the number of seconds the laptop can remain idle before being put to sleep when running on AC power. If not set, the laptop will not sleep when it's on AC power. -e, --event Adds an event file to the list that is watched. Using this switch disables polling all files in /dev/input/event*. -E, --no-events This switch disables event device polling. -l, --load If set, a load average higher than this number will prevent the computer from sleeping If not set, the computer will ignore the load average. -w If set, sleepd will also check idletime based on utmp. This will prevent the system from sleeping while remote connections are active. It uses the time limit from -u. -i, --irq Adds an irq to the list that is watched. Using this switch disables automatic detection of keyboard and mouse irqs unless -a is specified as well. -I, --no-irq This switch disables interrupt polling. -a, --auto Automatically detect and watch mouse and keyboard irqs. -s, --sleep-command Command to run to put the laptop to sleep. Defaults to "apm -s" for systems with APM and "pm-suspend" for systems with ACPI. -b, --battery If this option is specified, the daemon will put the laptop to sleep if the percentage of battery charge drops below the specified number and the system is off AC power. This is useful for some laptops which don't handle this themselves. It supports using APM, ACPI, and HAL for querying battery status. -d, --hibernate-command A command to run instead of the regular sleep command when the battery is low. This can be useful if you want to make the system go to sleep when it's not active, but suspend to disk if the battery is low. If not set, the sleep command is used. -N, --netdev Monitor a network interface for activity based on packet count. eth0 is the default. This option may be used more than once with different network interfaces. -t, --tx-min Set a baseline transmit raffic rate in packets per second for network monitoring. Requires -N. -r, --rx-min Set a baseline receive traffic rate in packets per second for network monitoring. Requires -N. -A, --and Only go to sleep if all specified conditions are met. For example, only sleep if idle and if the battery is low. -c, --check-period Number of seconds between check on system status. Defaults to 10 seconds, which should be fine generally. -H, --force-hal Force HAL to be used instead of ACPI or other methods to query battery status. SEE ALSO
sleepctl(1) http://kitenet.net/~joey/code/sleepd/ BUGS
Interrupt monitoring cannot always detect keyboard and mouse. If the keyboard or mouse interrupt is shared (as is common with usb devices), other devices on the same interrupt can keep the system awake. Use event device polling instead. AUTHOR
Joey Hess <joey@kitenet.net> SLEEPD(8)