Wakeup

Intro

Wakeup is a script to wake someone up -- an alarm clock of sorts. "Of sorts" because it is only the "alarm" part. at(1) does the "clock" bit. It's designed to be very flexible and (potentially) very annoying. If set up properly, it will wake you up no matter what - hence the name.

Philosophy

I don't wake up easily. Rather, I do, but I'm often reluctant to do such. In order to help wake me up, I wanted a system that was more powerful than a simple alarm clock. Alarm clocks can be flaky and a simple misconfiguration can cause it to not go off at all.

This software relies on the idea of "stages". Think of this as any multi-tiered alarm clock system that people set up for themselves (one clock across the room set at a later time, etc.). Each stage represents an attempt to wake someone up, generally increasing in power as the stages increase in number. The individual stages are "enter"ed after a certain amount of time. It will continue until the system is told that the user is awake.

When a stage is "enter"ed, some commands can be run. This could be something that turns on some speakers, starts some music, or anything that could potentially wake someone up. After a specified amount of time, an "alarm" command will be run for a given stage. That could be something like increasing the volume or turning on a light. It will be run every n minutes while in a given stage.

As each stage is "enter"ed, the previous stage is "exit"ed. Any cleanup can go there.

Requirements

Download

This code is Copyright ©2005 Steve Pomeroy and is released under the GPL. No warranty, use at your own risk, etc.

wakeup-0.2.tar.gz
ver. 0.2: added location-based stages; unified alarmclock into wakeup; repackaged; put into its own CVS repository; cleaned up; etc.
wakeup-0.1.tar.gz
ver. 0.1: initial release. For Tina, who suffers through it all too frequently.

Using wakeup

There are a number of scripts which make up the system. The main one is wakeup which various other scripts that are located in your stages directory. These are very similar to init.d scripts, except that instead of having "start" and "stop" as arguments, they have "enter", "alarm", and "exit".

wakeup
The main script. To set the alarm, type wakeup at TIME where TIME is a time value in the format of at(1)
wakeuprc.xml
The main user configuration file. See wakeuprc.html for configuration information.
awake
A sample "awake" script that user a temporary file in ~/.wakeup/awake. The accompanying stage script (awakevar) checks for the file and deems the user awake if it exists.
alarmclock
Deprecated. Use wakeup at TIME instead.

Location-based stages

As-of version 0.2, you can have location-based stages. This is intended for use with a laptop that roams between a number of known locations. At a given location, special scripts can be executed for any of the stages.

Using wireless network detection scripts, such as whereami, the current location can be stored in a text file (such as /var/tmp/location) and specified in the config file (see the example).

If you specify a location_based file in your config file, wakeup will read that file upon activation and look for a sub-directory off the stagepath named the contents of the location file. Any stages found there with the same name as the current stage will be activated.

For example, if you are currently in stage.1 and if you specify /var/tmp/location as your location_based file and it contains the word, home, wakeup will look for a script named stagepath/home/stage.1 and call it with the appropriate enter, etc. parameters.

Installation

            
$ su
# make install
$ mkdir ~/.wakeup
$ cp -R stages ~/.wakeup
$ cp wakeuprc.xml ~/.wakeuprc.xml
      
          

make install will defaultly install the various scripts to /usr/local/bin/.

Notice: this will not function out-of-the-box. The included software comes with no mechanism for being loud and annoying. You need to provide this functionality yourself.

You should edit the scripts in the stages/ directory and ~/.wakeuprc.xml to create a setup that works for you. Take a look at the sample scripts there -- they are a copy of my own configuration so you can see how I use it.